BluetoothLeScanner is not called in SM-G970N(Galaxy S10e)

183 Views Asked by At

I developed an App which contain ble function. And this app operated well on my development phone. But when I use this app on Samsung galaxy S10e, bluetooth is not working. And I found BluetoothLeScanner is not called. My development phone is galaxy S8 and its Version is Android 9.0(Pie), API 28. And another low version development phone(like galaxy 5, galaxy note 4) operated well too.

But galaxy S10e is same OS with galaxy S8(Android 9.0 Pie, API 28). I wonder why the app is not operate well on galaxy S10e.

I declared permission like that

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

And BluetoothLeScanenr is called here.

@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
public boolean BleDeviceScan(boolean enable)
{
    logD(TAG, "BleDeviceScan ( " + enable + " )");
    if(mBluetoothAdapter == null)
    {
        return false;
    }
    logD(TAG, "mBluetoothAdapter : " + mBluetoothAdapter.toString());
    if(mBluetoothAdapter.isEnabled())
    {
        if (enable)
        {
            Log.d(TAG, "BleDeviceScan Build.VERSION.SDK_INT < MIN_SDK_INT - ELSE");

            timerFlag = true;
            timer = new Timer();
            bleTimer();

            mLEScanner.startScan(filters,   settings,   mScanCallback);
            mListener.bleScanStart();
        }
        else
        {
            deviceShowCount = 0;
            timerFlag = false;

            bHandler.obtainMessage(1).sendToTarget();

            mLEScanner.stopScan(mScanCallback);
            mListener.bleScanStop();
        }
        logD(TAG, "BleDeviceScan Fin");
        return true;
    }
    return false;
}

this function is not called in galaxy S10e.

mLEScanner.startScan(filters,   settings,   mScanCallback);

Should I declare something to use BluetoothLeScanner on galaxy S10e? What is the problem?

1

There are 1 best solutions below

3
On

Based on your description, scanning does not start because mBluetoothAdapter.isEnabled() always returns false. Can you verify that is the case?

If the above is true, do settings on the device say that Bluetooth is turned on? If so, can detect BLE devices with an off the shelf app like LightBlue or BeaconScope?