We are developing an android application which connects to Bluetooth device using secure simple pairing. As expected, We observed that when ever the application connects to Bluetooth device using the android provided API's, a pairing confirmation dialog is generated for user confirmation.
On Nexus4, we observed that pairing notification is generated sometimes and the user needs to select the pairing notification to confirm pairing. Looking into the source code of Setting Application, specifically(BluetoothPairingRequest.java), there is a check for screen on/off to decide whether to generate a pairing dialog or notification. In our case, the screen is on, but it still generates a notification. Can someone please provide information on how this usecase(pairing notification) can be avoided.
Thanks in advance.
-Ashwin
Related
I am trying to develop a companion app for a project of mine.
I want this app to relay incoming notifications on my phone to a device connected via BLE. This device will then display the text data on a screen, similar to a heads up display so that I can use it in my car and not have to go through my phone while driving (also illegal of course).
I want to know what is required for my app to be able to get notifications, and send it via BLE to the already connected device. I'd also really like to know if this can be done for an iOS app since I would prefer to end up with the final app being built for iOS. If not, android is fine for now.
This device is an ESP32 and will run its own code to execute actions when text is received.
Thank you
I have a raspi3 with android things on it and I want to connect to a BLE device that requires a user authentication for bounding.
On a phone, after having set a characteristic on the BLE device, I am able to receive the Broadcast event
BluetoothDevice.ACTION_PAIRING_REQUEST
and in the meantime a dialog from android system opens asking me to accept the bluetooth connection (it has pairing variant = 3 (PAIRING_VARIANT_CONSENT)). When I accept it on the dialog everything goes nice and I connect to the device.
In my android things device I don't receive any ACTION_PAIRING_REQUEST event and my connection drops as soon as I write the characteristic on the BLE device.
Is there any way to have the accept process on android things?
You can use the Android Things BluetoothConnectionManager to initiate device pairing or respond to incoming pairing requests with a BluetoothPairingCallback. See the Bluetooth API guide for more details on device pairing.
I'm working on Android app that pairs and interacts with BLE accessory. When app initiates pairing with the accessory for the first time one of two things happen:
Either phone shows pairing dialog with the field for PIN code
Phone adds new notification to the statusbar with small BT icon.
User then has to swipe down and tap "Touch to pair with ..." notification that presents the prompt.
What does it depend upon? Is there a way to encourage OS to show dialog instead of the notification?
There is nothing you can do about it. This is totally dependent on the OS (version/variant/manufacturer).
I am really struggling with this problem and I cannot find a way to do it. I need to show the default dialogs from Android when pairing with a Bluetooth device.
Right now I achieved to pair them programmatically with a quite easy method but it only works from API 19. And I need this to be done from API 18.
Right now, when I connect to a device in my app I get the notification asking to pair a device, but it doesn't show the dialog to do so. If I want it, I have to expand the notifications in the device and click in the pair request notification.
Is there any method which I could call, for example when I receive the notification in my broadcast receiver, to show me the default pairing request dialog? And after the user accepts the pairing and inputs the PIN just do the process to pair, dismiss it and keep using the app?
Your help would be much appreciated!
I want to implement Push Notification for an App (both iOS and Android) and need clarifications on the following scenarios.
I understand how the Push Notification works in general and the limitations. I did read the docs but that just got me confused and didnt answer all my questions.
How are the following scenarios handled in iOS and Android:
When the device is turned off
When the device is not connected to 3G or Wifi networks
When the device has crashed and need restart
When the App is in foreground
When the App is in the background
When user is currently using the App
When my app is closed (not opened / launched)
When a push notification is user specific and both users share the same device and app. Example: If a husband and wife share same device and use a bank App with Push notification.
Can you send User specific notification if device is shared by multiple users?
When user has installed App on multiple devices
Can you send a notification to all devices registered by a user at once?
Do you store the device type (iOS or Android) with the registrationID in the User table or is there a way to differentiate the type of device by inspecting the token or registrationID?
Can you cancel a previously sent notification which is not read yet and send a new one?
Is it still true that Android Push Notifications does not work on Kindle Fire and will need to implement Amazon Device Messaging
Anything else that I need to think of or plan? I am aware of handling un-registering and feedback service
I would answer some of your questions, specific to android thought. Don't know about iPhone, If its of similar kind or not.
The device receives notification from Google Cloud server as and
when the notification is triggered by the server and it doesn't have
any relation with application state (Running, Closed, Background or
foreground).
If the notification is sent to a device when its not connected to
the internet ( switched off or not connected to the net) , it gets
notification only when it connects to the network. However, if the device
is crashed and restarted after the notification is received, you
won't get the notification again.
Is it user specific?
It depends on the individual servers implementation.
Do we store device type?
Yes we can.
Can we differentiate the IDs of iPhone and android?
Yes, android Device IDs are longer in length than iPhone's.
Can we cancel an already sent notification?
No, it is a one way communication channel as far as I know.
When the device is turned off:
Answer:
IOS/Android Server (Not your Server) will handled when to send the Push Notification. It checks that device is reachable or not. We can define that how many times IOS/Android Server should try to send Push Notification.
When the device is not connected to 3G or Wifi networks
Answer:
Nothing related to 2G/3G/Wi-Fi. Device should be connected to Internet via any network.
When the device has crashed and need restart
Answer:
IOS/Android Server checks that device is reachable or not.
When the App is in foreground
Answer:
Nothing related to app in foreground.
When the App is in the background
Answer:
Nothing related to app in background.
When user is currently using the App
Answer:
Nothing related to app being used currently.
When my app is closed (not opened / launched)
Answer:
Nothing related to app is closed.
When a push notification is user specific and both users share the same device and app. Example: If a husband and wife share same device and use a bank App with Push notification.
Answer:
It depends on how you have implemented on YOUR Server. You will be managing Device Id for each user. So it's upto your implementation logic to send to same device for multiple users.
Can you send User specific notification if device is shared by multiple users?
Answer:
It depends on how you have implemented on YOUR Server. You will be managing Device Id for each user. So it's upto your implementation logic.
When user has installed App on multiple devices
Answer:
It depends on how you have implemented on YOUR Server.
Can you send a notification to all devices registered by a user at once?
Answer:
Yes again as per your implementation logic.
Do you store the device type (iOS or Android) with the registrationID in the User table or is there a way to differentiate the type of device by inspecting the token or registrationID?
Answer:
Yes you need to store the device type, to identify to which Server (IOS/Android), you need to send request for Push Notification.
Can you cancel a previously sent notification which is not read yet and send a new one?
Answer:
No you cannot cancel the request.
Is it still true that Android Push Notifications does not work on Kindle Fire and will need to implement Amazon Device Messaging
Answer:
Need to google it around.
Anything else that I need to think of or plan? I am aware of handling un-registering and feedback service
Answer:
Need to google it around.