Force android bluetooth discovery on - android

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.

Related

Android Bluetooth Discoverbility Dialog

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.

Android Awareness of remote Bluetoth-Request with disabled BluetoothAdapter

I'd like to use android's bluetooth for some kind of sensing devices. But I don't want to connect to these devices. As far as I know Devices won't react to scanning when their own bluetooth is disabled. But is there any way to get my app noticed when such a scan has been performed by a remote device, even when my app is running with bluetooth turned off?
I don't want to force toggling bluetooth on, but I need to get some kind of Action started in other devices running the same app. So I'm wondering if some there is any description/data field that can be sent with a bluetooth scan, so if scan is rejected the app has the opportunity to read that data just to know there was this specific call?
I need to leverage context-awareness within my system as to users, not knowing each other, still can interchange content (if they agree). But I need to find some ways of sensing while I also don't want to have all sensors activated all the time.
Hope you can give me a hint, or tell me that this is simply not possible, which would also help me not spending any more time on that.
Thanks.

Is it possible to lock the bluetooth in android device for a specific time period

I am able to disable Bluetooth using Bluetooth API`s Disable method .but my requirement is also to prevent the user interaction for Bluetooth when my apps is running.Is there any way to prevent the user interaction i.e when the user try to enable Bluetooth the app will block it.
Thanks in advance.
This is a small piece of code that needs to be written to disable/block bluetooth access. However, if you want to modify the functionality lagely, rooting is the solution. However, this post is already having relevance to the one noted ast : How to enable/disable bluetooth programmatically in android

Which is better w.r.t battery usage ? Having bluetooth always on OR switching it on/off intermittently ?

I'm writing a app that requires bluetooth. I periodically check if I need to synchronize some data.
W.r.t battery usage which is better ?
Having bluetooth always on and using it when needed for communication.
OR
Switching it on when needed and switching it off.
I believe you shouldn't force the BT state on the users, for whatever reasons they might prefer to keep it on or off. The only thing you application can do is to ask the user to switch BT on whenever you need it (using intent BluetoothAdapter.ACTION_REQUEST_ENABLE), and if you ask every 30mn or so it is rapidly going to be annoying.
Remember the enable() method in BluetoothAdapter should not be used without user consent (from sdk reference):
Bluetooth should never be enabled without direct user consent. If you want to turn on Bluetooth in order to create a wireless connection, you should use the ACTION_REQUEST_ENABLE Intent, which will raise a dialog that requests user permission to turn on Bluetooth. The enable() method is provided only for applications that include a user interface for changing system settings, such as a "power manager" app.
I think it really depends on the time interval between your checks. If the checks are at large intervals, it's better to switch on/off, otherwise, if they are often it probably won't make much difference to keep in on.
Add a button to "turn on bluetooth and sync", when it's over give the user feedback and then request to turn it off.

Possible to customize the Android Bluetooth pairing request notification?

I'm trying to create an Android App that makes it very clear and simple for a user to connect to a bluetooth device to collect some data.
Ideally, I'd like to eliminate the pairing request notification and have the app auto-pair to the device but not sure if this is possible. If not, is it possible to customize the pairing request notification? It currently says "To pair with XXX confirm it is showing the passkey..." Can that be customized to be more user friendly?
Is there anyway to bypass this?
Thanks
Don't believe it's possible to avoid pairing.. My opinion is that is mandatory there for security reasons...

Categories

Resources