Closed hamzaahzam closed 2 years ago
@hamzaahzam Could you please refer to the following URL and check if the permissions are properly granted according to the target SDK version? https://github.com/star-micronics/react-native-star-io10#android
@bandit-ibayashi I have added all the permissions for android it is crashing on my Redmi Note 10 Pro android version 12
In Logs I am getting this error
java.lang.SecurityException: Need android.permission.BLUETOOTH_CONNECT permission for android.content.AttributionSource@655f4942: AdapterService getBondedDevices
same issue i am facing
@hamzaahzam
It is possible to request the permission android.permission.BLUETOOTH_CONNECT
with the following code, but could you still not get the permission by doing this?
https://github.com/star-micronics/react-native-star-io10/blob/e544aacab74b480540558641dc8003a7126f30d8/example/samples/discovery/App.tsx#L101
This code must be executed when Android 12 or later and targetSDKVersion is 31 or later.
I executed our discovery sample code on a Google Pixel 6 with Android 12 and was able to successfully search for Bluetooth printers.
@bandit-ibayashi Thanks after requesting android permission I was able to find printers and send request for printing.
But I am facing an issue on Redmi Note 10 Pro after requesting permission it starts searching for printers but always returns nothing on onDiscoveryFinished
@DevHumzaAhzam
Found printers are retrieved with onPrinterFound property, not onDiscoveryFinished.
onDiscoveryFinished
property indicates that it only notifies the user that the Discovery process is finished and does not return information on the printers found as a result of the Discovery process.
You can also refer the sample code here.
Or would it be a case where onDiscoveryFinished
is issued as soon as startDiscovery method is executed in your situation with Redmi Note 10 Pro?
We will close it once there have been no comments for a certain period of time. If you continue to experience this problem, please create a new Issue.
Description
Unable to search for devices and printers on latest android version.
Device where the bug occurs
Your printer
Your development environment
macOS
Also, the result of executing the command
npx react-native info
.Code To Reproduce
Error
In android 12 while running the above code app crashes and in android 11 app doesn't crashes but unable to scan nearby printer. But same code works fine on android 10 and earlier versions.