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
Related
We have our own rooted hardware device with android OS 7.0
We are building an app for that device. We have to restrict the users to performing some of the actions who will purchase that device. Here are the list of actions We want user to be restricted to perform on the device through the app.
Stop installing/uninstalling any other apps from OS.
On/off wifi
Pair Bluetooth
Change wallpaper
Basic idea behind is to make an app which will be the system app and will restrict user from the things mentioned above.
Is this possible to make such app? Looking for help in any of the above tasks. Thanks
Shor answer: NO.
Here is why;
The Android operation System is based on permissions, and no app can restrict that actions even with the users' permission. The reason for this is because of the Android App Layer that provides all the capabilities you described above.
The only way you can do such thing is to Customize the ROM of the CellPhone. In this case, you can override the functions that allow the user to use such services.
I implemented an SMS app. Now I'm having trouble with Oppo devices because whenever a message is received, the system changes the default app to the built-in app and shows this message:
For your messages security, System message app has been set as the default message app
I need to solve this issue programmatically as thousands of users will be using the app and I cannot let them change it manually
Found this in a other thread on OPPO:
Whatever settings you change for the messaging will not make any difference, the phone will always revert to the default app.
I took this up directly with OPPO and had the following response:
We decided not to allow customer to set 3rd party applications as default message application, for security of the devices cannot be guaranteed. We also want to let you experience our built-in application and to be spared from the malfunction like virus, bug or etc.
Not the response I wanted or expected!
Possibly the phone has been set this way is because in China the government is granted access to all private communications as a way to preserve a permanent dictatorship? Thus Chinese brands may be knowingly spreading these settings in android devices around the world.
What I would like to do is create an app on the Android that allows the following:
Allows the phone to have two unlock pin codes. One unlock code will the the master "normal" code. The second unlock code will allow the user to receive and send texts, make and receive phone calls, store pictures, and contacts that will not show up in the "normal" screen.
You cannot do this with an app. Apps cannot change system behaviour unless they are 'system administrator' apps. Even those cannot do such fine grained control, only impose restrictions on unlock code strength, camera use and device encryption. As others have noted, Android 4.2 supports multiple users (on tablets only), which gives you a separate unlock code for each user. Additionally, some operations that affect the whole device, such as adding new users, adding or removing trusted certificates, accessing the secure element, etc. are reserved for the first/primary user. You can't place calls with a tablet though, so multiple users doesn't really apply to calling/SMS.
I was reading this
http://developer.android.com/guide/topics/wireless/bluetooth.html#QueryingPairedDevices
which is allot of help on how to pair,connect to a bluetooth device.
I have a situation where I have several BT devices that are in Non-Discover mode always. I know the MAC and the PIN of these devices. IS there a way in Android Dev to manually add devices to the PAIRED list so i can just use the connect as a client.
I understand this maual is written allot for V3. i think i will need to do this on 2.0 ; 2.1- has anybody done this before?
Basically these devices I want to connect to are power saving modules I used pre built BT modules to monitor daylight, another one humidity, etc.. every 3hrs or when interrupted and runs of a single battery for months. So turning off divcory on server saves immense power and prevents other people trying to connect and waste battery.
Not sure what you mean by "manually": Do you mean "manually" as in GUI/user interaction, or "manually" as "I do it in my own application code"?
Some suggestions though:
If you can make your BT devices discoverable at all, you could do it this way:
Make your BT device discoverable
Let Android search for and find the device and then initiate a connection
Android will ask for the PIN for pairing with the device; enter the PIN.
Once pairing was successful, Android stores the pairing information for future use, so that you can
Make your BT device invisible again.
From then on your app should be able to connect to the BT device at any time without further pairing operations.
If the said is not an option for you, maybe you want to go another way:
In current Android versions there are different API routines implemented which are neither documented nor exposed in the normal SDK. A hack kind of solution may be to use some of these "hidden" ("#hide"...) APIs, either via reflection or via modification of your SDK installation.
But be aware that this is always a hack and it may work on a specific device with a specific version of Android and is likely to break your app on another device and/or any other Android version.
Having said that, here comes some reference:
Example of how to access "hidden" bluetooth API.
Then, have a look at the source code for android.bluetooth.BluetoothDevice, e.g. here.
In there, public boolean createBond(){...} may do what you want.
I wanted to build an application related to Bluetooth in Android . Is there any way by which I can set the PIN from my application in Android other than using system dialog box to enter PIN which pops out . I checked for API's given by Android for bluetooth, but I could not locate any API for setting keys for bluetooth as provided in WiFi manager e.g. wificonfig.presharedkey = xyz.
Thanks in Advance
It is not possible using the public APIs.
There are few reasons why this is a bad idea ,
1. Pairing by entering PIN is performed with old bluetooth deices (one or both device with Bluetooth version 2.0 or lesser)
2. Bluetooth 2.1 and onwards will use different mechanism for pairing and may not require user to enter a PIN instead it can show user a number / message and ask for user's confirmation.
So if your application has to work in all conditions it is better for it to use the system provided mechanism. (Which prompts the user for PIN / confirmation etc as applicable)