Skip to content
This repository has been archived by the owner on Jan 27, 2021. It is now read-only.

Not scanning or discoverying nearby bluetooth devices. (startActivityForResult) #107

Open
ritchie-tg opened this issue Oct 28, 2020 · 2 comments

Comments

@ritchie-tg
Copy link

ritchie-tg commented Oct 28, 2020

Greetings,
Firstly, thanks for this awesome library. I used it about a year ago for an ESP32 project I was doing. Everything was working great. I revisited that same - once working - project to find issues. A problem I've been having is the only devices detected on the activity (BluetoothState.REQUEST_CONNECT_DEVICE) are devices I have paired through Android's settings. When I press scan for devices, it doesn't scan. The client device is available and detected when using Android setting for Bluetooth > pair a new device. But not in the app, using this library. This happens on three Android devices I own from a Google Nexus 5, Moto x4, and Moto G7 Power.

I'm not sure what is the difference between then and now?

I/OpenGLRenderer: Initialized EGL, version 1.4
D/OpenGLRenderer: Swap behavior 2
I/Choreographer: Skipped 62 frames!  The application may be doing too much work on its main thread.
W/ActivityThread: handleWindowVisibility: no activity for token android.os.BinderProxy@6dda9fa
D/BluetoothSPP: doDiscovery()

And nothing further.

bt.startService(BluetoothState.DEVICE_OTHER); // start bluetooth service
bt.setupService(); // setup bluetooth service
Intent intent = new Intent(getApplicationContext(), DeviceList.class);
startActivityForResult(intent, BluetoothState.REQUEST_CONNECT_DEVICE);
    <uses-permission android:name="android.permission.BLUETOOTH" />
    <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

I manually request permission for each permission. Only write access is promoted and requested because Bluetooth isn't considered "dangerous." Yet, when pressing the connect button, I am not asked for bluetooth permissions at all.

The readme state to declare <activity android:name="app.akexorcist.bluetoothspp.DeviceList" /> which I'm guessing you meant in the AndroidManifest.xml? The name is red and flagged in Android studio. No idea. I can't seem to find an answer on that.

@felangga
Copy link

felangga commented Nov 9, 2020

having this same issue,

I just found out that it's only showing the paired devices.

image

@ghost
Copy link

ghost commented Nov 12, 2020

I've moved onto the flutter blue libraries. They're currently updated.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants