You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a requirement where i need to identify the remote connected device, if any. As of now, with this package am only getting paired devices name and address.
I cloned this package into my visual studio code and tried to get the connected devices in Android by modifying the FlutterScanBluetoothPlugin.kt.
I added these lines in my code to get the connected devices, but somehow its not working.
`private var bluetoothManager: BluetoothManager? = (activity.getSystemService(Context.BLUETOOTH_SERVICE) as BluetoothManager)
private var adapter: BluetoothAdapter? = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
this.bluetoothManager?.adapter
} else {
BluetoothAdapter.getDefaultAdapter()
}
I have a requirement where i need to identify the remote connected device, if any. As of now, with this package am only getting paired devices name and address.
I cloned this package into my visual studio code and tried to get the connected devices in Android by modifying the FlutterScanBluetoothPlugin.kt.
I added these lines in my code to get the connected devices, but somehow its not working.
`private var bluetoothManager: BluetoothManager? = (activity.getSystemService(Context.BLUETOOTH_SERVICE) as BluetoothManager)
private var adapter: BluetoothAdapter? = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
this.bluetoothManager?.adapter
} else {
BluetoothAdapter.getDefaultAdapter()
}
var isConnected = this.bluetoothManager?.getConnectionState(device, BluetoothProfile.GATT)
println("device isConnected : " + isConnected)`
Please let me know if this is correct or not.
The text was updated successfully, but these errors were encountered: