結果因為手機Android版本是6.0
所以要多加兩個步驟.
步驟一
- Add
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>to your manifest.xml
步驟二
int MY_PERMISSIONS_REQUEST_ACCESS_COARSE_LOCATION = 1;
ActivityCompat.requestPermissions(this,
new String[]{Manifest.permission.ACCESS_COARSE_LOCATION},
MY_PERMISSIONS_REQUEST_ACCESS_COARSE_LOCATION);
引用來源:
https://stackoverflow.com/questions/34966133/android-bluetooth-discovery-doesnt-find-any-device/36177638#36177638?newreg=854649a9202343e998e23d78f0d2028e
沒有留言:
張貼留言