Memo - Android

This is one of my memos about using Android.

Memos are used for recording the problems I encountered during programming and its solutions. I also write down something that is hard to remember for myself.

Programming

Must Read

Some information and tools

JDK

# Find the location of JDK
/usr/libexec/java_home -v 1.8

Use Java 8 language features in Android Studio 2 Use Java 8 language features in Android Studio 3

Android basic knowledge

Fragments

Gradle

配置构建

BLE

Official - Bluetooth Low Energy RxAndroidBle

startActivityForResult

How to manage startActivityForResult on Android?

@Override
protected void onCreate(Bundle savedInstanceState) {
    // ...
    int REQUEST_ENABLE_BT = 111;
    Intent enableBtIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
    startActivityForResult(enableBtIntent, REQUEST_ENABLE_BT);
}


@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    if (requestCode == REQUEST_ENABLE_BT) {
        if (resultCode == Activity.RESULT_OK) {
            ble.setText("Bluetooth opened!");
        }
        if (resultCode == RESULT_CANCELED){
            ble.setText(("Bluetooth not opened!"));
        }
    }
}

Use

已连接,但无法访问网络

关于 ANDROID 5.0-7.1.2 网络图标上的感叹号及其解决办法

  • Setting -> Anbout phone -> Click Build number 7 times (unlock Developer options)
  • Open USB debugging after connect computer (tested with Mac OS X) and your Android device (Google Pixel, Android 7.1.1)
  • Authorize action in your Android device for the first time of connection
  • Find your SDK tools in your computer. For me, is (~/Library/Android/sdk/platform-tools). You shuould install android SDK first. For me, I get this by Android Studio.
cd ~/Library/Android/sdk/platform-tools
# Optional, just for convinecnce.
export PATH=`pwd`:$PATH

# Add Vendor number to adb_usb.ini
echo 0x18d1 >> ~/.android/adb_usb.ini

adb kill-server
adb devices
adb shell "settings put global captive_portal_mode 0"

Categories: ,

Updated:

Leave a Comment

Your email address will not be published. Required fields are marked *

Loading...