AndroidLEDcontrol icon indicating copy to clipboard operation
AndroidLEDcontrol copied to clipboard

AVAILABLE DEVICES can't show my device.

Open lowfiend opened this issue 10 years ago • 1 comments

ArduDroid app can show my device.

But your app cannot.

What can I do?

lowfiend avatar Dec 22 '15 13:12 lowfiend

Did you try add permission on AndroidManifest.xml file?

<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />

and you need to add this in MainActivity.java. I add them in onCreate() function.

Services running on Android 10 and higher cannot discover Bluetooth devices unless they have the ACCESS_BACKGROUND_LOCATION permission. See https://developer.android.com/guide/topics/connectivity/bluetooth

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
  if (ContextCompat.checkSelfPermission(baseContext,
      Manifest.permission.ACCESS_BACKGROUND_LOCATION)
      != PackageManager.PERMISSION_GRANTED) {
          ActivityCompat.requestPermissions(
              MyActivity.this,
              new String[]{Manifest.permission.ACCESS_BACKGROUND_LOCATION},
                  PERMISSION_CODE)
      }
}

stingch avatar Apr 08 '21 07:04 stingch