Is there any possibility to refresh the service list of a paired device in a programm?
At the moment, i have to go to the bluetooth options and select the device properties of the bluetooth device and have to refresh the service list manually.
Is there any API that RIMM provides to do programmatically?
thanks,
Have you tried using DiscoveryAgent.startInquiry()? Or if you already have a RemoteDevice object for the device you're interested in, you could use DiscoveryAgent.searchServices()
http://www.blackberry.com/developers/docs/5.0.0api/javax/bluetooth/DiscoveryAgent.html
Related
I am creating an IOS App to connect into a Bluetooth Device using Classic Bluetooth with Mpi using ExternalAccessory Framework.
Using showBluetoothAccessoryPicker method, I can display an alert with a list of devices that allows the user to select one Device to pair.
I can perform Steps 1 -5 of my use case as below. However I not able to perform step 6
Use case:
The User picks one Device to pair. On that case, I am using showBluetoothAccessoryPicker
The App stores, into a variable, the accessory that the user picked
Turn off the Device
The App shows an alert "Connection dropped"
Turn On the Device
The App needs to reconnect with the Device automatically without needs to select it into a list.
Is there any way or method to pair a device without display a list?
As my company is a member of the Apple MFi licensing program, I asked for Apple support and I received the answer below.
"
In response to your request below, there is presently no support for implementing the bluetooth reconnection process from the device side after an existing connection has been broken. This would be an API enhancement request which you can submit using the Apple Developer feedback assistant web page - https://feedbackassistant.apple.com.
"
"
One option would be for the accessory to handle the reconnection process itself as this is a supported bluetooth option. However, I understand if for power conservation reasons, this is not supported accessory option."
It means, there is no way, yet, to implement it from the App side. if you need that, you need to do it on the Device side.
We can submit feedback for the Apple, using the Apple Developer feedback assistant web page - https://feedbackassistant.apple.com to ask them to create it
you need to make some changes in your firmware to reinitiate the connection when it identifies the connection drop. Or else you can write a method and call on connection drop in your application which keeps looking for device in proximity (with accessory info saved in your app variable) and as and when it finds, it connects using that accessory instance.
I've searched everywhere for the answer to this and have yet to find a definitive answer... Please help...
I have created an app that connects and bonds to a BLE device which requires a pin. The pin is pragmatically created and displayed to the user before the iOS bluetooth bonding dialog is triggered. So far, so good. If the user correctly enters the pin into the bonding dialog the phone and the BLE device are now bonded and everyone is happy.
Now the user closes the app and terminates the bluetooth connection.
When the app starts up again and the BLE device is discovered, is there any way to know that the bonding has already taken place? Basically, I don't want to re-display a pin to the user if the device has already bonded.
I'm currently saving the identifier of the BLE device and calling RetrievePeripheralsWithIdentifiers to see if the device has been connected before. This works but if the user goes to the bluetooth listing and selects "Forget this device", RetrievePeripheralsWithIdentifiers still returns ther peripheral. I've tried restarting the phone, uninstalling and reinstalling the app. Nothing seems to make iOS forget that at some point in the past, that identifier was connected...
Help!
iOS has no API whatsoever for pairing or bonding. iOS will only prompt a pairing dialog upon request from the other device or when it reads a characteristic that requires security. Your app won't even know that the pairing dialog is being shown, when pairing is complete, or when/if the current link is encrypted.
If the device is already bonded and the LTK that iOS has stored during a previous pairing process can be used (the slave also has it), then the link will automatically be encrypted and therefore no new pairing dialog will be shown.
The list about previously connected devices has nothing to do with bonded devices. It's just a list of previously known devices.
I think you are mixing up concepts a bit. Bonding essentially means "having the same Long Term Key".
So if you have two devices, and you want them to open up an encrypted connection, both devices simply check if they have a key associated with the corresponding device, and try to use this key to encrypt the messages.
This is why a device can't really check if the bond still exists. Each device can check if its own key still exists, but how would it know if the other device still has the key? As soon as one side has forgotten the key, the bond is lost.
I don't have much experience with iOS, but I assume their should be a function to get the stored Long Term Keys to check if there is an LTK associated with a Bluetooth address. Alternatively, it should be possible to
use external storage so that instead of the stack doing it for you, you can define a file where all keys are stored, and provide the stack with the key when needed. (At least, this works with other implementations.) In this case, you could directly look in the file to check if the devices have been bonded.
Note that entering the pin corresponds to the process of "pairing". The successful conduction of this procedure and the subsequent encryption of the connection does not prove that the devices are bonded. After disconnection, the pairing information is lost and the devices need to pair again - except if you have stored the key, which makes the pair a bond.
I faced a similar problem in my app, where if the user selected "Forget this device" from the settings then my app wouldn't know.
You can use retrieveConnectedPeripherals(withServices: [CBUUID]) to check if your device is connected to the OS. If yes then proceed with your other functions, else show PIN again(or whatever you want).
retrievePeripherals(withIdentifiers:) will return the device if it was connected to your OS previously.
I am doing this in my app. Hope this helps.
I am new to Swift and is currently developing an Multipeer Connectivity app for a course project. The app also has an online log-in feature that stores each user information in Firebase(the backend support).
Once the app gets wifi connection, I want to have a 'friends list' feature in my app and add other app users to this list from the nearby devices found. So far, the only way I could think of is to associate the peerID with an existing app user from Firebase. However, according to the documentation, peerID seems to be associated with the device itself so if two different users used the same device to sign in, this approach can't really work. Is there a better way to achieve my goal?
In my opinion, it depends on what do you want to go with your application as well as how you develop it regarding your business. One of possibility is that one user as a point of time is just registered one device. So you can provide a simple login screen that users will enter their name then map it with device id and save to Firebase. The username is considered as user id as well. So if they try to sign in from another device, you will check whether or not it existed in the system. if existed, ask them that wish to register this device or not, then update your map (user id and device id) from Firebase.
From your friend list, it is still a list of the username of your friends,in which you can add any nearby devices found.
I found on the Apple website that:
Support is also provided for waking previously paired accessories that
do not automatically connect.
This would be useful for me, as the user does not need to do pairing every time before he launchs the app.
I referred to the EAAccessory Manager API, but there seems to be no such call to it.
Can anyone provide me more reference on this topic and how can I go about doing it?
This topic is explained at EAAccessoryManager Class Reference, on showBluetoothAccessoryPickerWithNameFilter:completion: that says that:
This method synchronously displays an alert containing the list of Bluetooth accessories that have been discovered by the current device and that match the specified filter (if any). The user can select an accessory from this list and pair the device to it. Pairing an accessory updates the accessory manager’s list of connected accessories and generates a corresponding connection notification.
Of course it's not enough to connect the external device successfully, because you have to do a few more steps before and after calling this method, like adding a protocol string of the external device on "Supported external accessory protocols" property of your project's plist etc, but it would be an answer to another question. Hope it helps.
The documentation on ANCS is pretty clear that you can react to notifications when they are coming in, have come in, and when they are cleared from the Notification Center; however, what if I wanted to give a user the ability to configure my Bluetooth 4.0 accessory to only respond to notifications coming from a specified app?
The ideal UI for this would be a simple list of apps they either have installed or apps that have been granted access to the notification center with an on/off switch.
Thanks for editing! I wasn't sure if we were "allowed" to link to Apple documentation or not.
To get a list of the installed apps, there is no dedicated API. You can use the URL scheme trick to detect whether an app is present but its enabled state in the notification center is not detectable in any way. However, based on the URL scheme app list, you can configure your peripheral for a subset of the installed applications and you can provide additional options for the user for other apps. (Though, I think most apps that come into consideration for you should have URL schemes.)