2

I am programming an Android application within Android Studio to scan the perimeter for nearby Bluetooth devices. The application works perfectly when tested upon an Android device.

When I test the application on a phone that runs on Cyanogen OS, v13.1.4 API level 5 (Elderberry), the application does not perform the BT scan as it does on the other Android phone.

I'm using this code to commence the scan process every 6 seconds and using a broadcast receiver to filter the results.

private void start() { //Handler commencing BT scan for 6s period

    BTAdapter.startDiscovery();

    Handler handler = new Handler();
    handler.postDelayed(new Runnable() {
        @Override
        public void run() {
            Log.d("BT Search", "Scanning");
            if (BTAdapter.isDiscovering() && !status)
                BTAdapter.cancelDiscovery();
            if (status) start();
        } }, 6000);
}

I have both of the permissions specified below within my Manifest

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

Has anyone had this problem before and solved the issue?

Best wishes,

Jordan

JordC1995
  • 57
  • 7
  • I've got the same problem. Devices with Cyanogen mode always return empty list of scan results. Have you found a way to solve this problem? – Michał Adamczyk Nov 06 '17 at 13:48
  • I never solved the problem unfortunately, I had to resort to switching devices. Sorry I cannot be of help. – JordC1995 Feb 26 '18 at 15:16

0 Answers0