when I want to connect a Bluetooth device I have to turn on the visibility of my device.
Is there a possibility to prevent the dialog which asks for permission to start visibility for a given time?
It should only start and not ask for permission.
Thanks for your help;)
Its a security mechanism of android. You cant remove it. But you can pair your devices, this causes that the dialogue isnt shown anymore.
Related
We have an Android app that pairs to a BLE device (which we also produce) and we are having some issues with the default Android pairing dialog:
The issues are:
Our device does not need access to contacts or call history. Is it possible to remove that option? The pairing and our functionality will work regardless of whether the box is checked or not but our customers think they have to check it and have expressed concerns as to why we need that information. This option seems to have been added in Android 6.
"Type the pairing code then press Return or Enter" doesn't make any sense as there is no pairing code and no input field. It would be nice to get rid of/change this text.
Is it possible to tweak the dialog via the app (preferably), or possibly by changes in the BLE device?
(I realize that the dialog might differ with different Android versions and/or manufacturers. The screenshot is from Nexus 5X with Android 7)
At the moment you can't customize the apperance of the dialog in the app level, the only thing you could do is enable/disable the checkbox for allow the access to contacts or automatically accept the dialog and the pairing request using theBLUETOOTH_PRIVILEGED permission.
But you can't use this permission if your app is a third party app (non-system app). To learn more, see Android API: BLUETOOTH_PRIVILEGED
I am developing an application in which I am communicating with an USB device.
When I connect the USB device for the first time and run the application, it asks for the USB permission.
I want to suppress that dialog so it won't prompt the user anymore. I know that it asks for user permission as per the results I've found so far, however I want to know whether the dialog can be suppressed.
Is their any way by which the user can assign the permissions at install time and wont get that USB permission dialog box?
I think that the answer is that it is not possible.
I have not found a way to suppress this so far. I think that this is primarily down to the fact that the permission is granted to a specific device and of course the device is not likely to be known at install time.
What you would effectively need is a blanket "any USB device" permission and I certainly have not found such a thing so far.
I can take none of the credit for this, but the answer is that it can be done using an intent-filter on USB_DEVICE_ATTACHED - see USB device access pop-up supression? for the solution, including a handy demo app.
Is there a way to force the bluetooth adapter to be discoverable? Like the BluetoothAdapter.Enable() method?
I know about the BluetoothAdapter.ACTION_REQUEST_DISCOVERABLE but it show a dialog to the user.
I want to do this to make it easier for the user to use the application - so they can set a Auto connect setting to true... and then it wan't ask these questions again. But I don't know how to get around the dialog?
BR
You can't do that without user interaction. You can autoconnect to a previously paired bluetooth device but you can't make the device discoverable without user interaction I believe for security reasons.
Is there a possibility to force dialog show to user for entering a PIN.
I have a barcode reader, that on server side (I think), and he need to get a PIN code. But the problem is that all androids up 2.2 don't won't to show dialog. (The 2.2. show dialog and the pairing are ok).
In my code I reach discovering devices, and the next step is a paring.
I will be thankful for give me some explanations
A Simple answer would be NO, It can't be possible to force user in PIN dialog as it is system generated.
You may create your own System checking for bluetooth pairing. A BroadCastReceiver will help you in this matter.
I am running an embedded system on android 2.1. The system has a bluetooth chip.
Calling getDefaultAdapter returns an adapter so BT is available
however i'm not able to enable the adapter even when user gives permission.
I also tried using bluetoothadapter.enable() and its still not working.
I've tested the code on a phone and it works,
What could be going wrong?
Do not use without explicit user action to turn on Bluetooth.
Bluetooth should never be enabled without direct user consent.
See the documentation.