Is it possible to start an app in case of an bluetooth connection to a specific device? Maybe the application have to run in background. In this case i want to open a specific view or activity after the bluetooth connection!?
Asked
Active
Viewed 5,335 times
1 Answers
4
Write a braodcast receiver which listens to bluetooth connection and in onReceive
check if connection is with the device you need. If so, then open your app from the broadcast using the intent.
action in manifest for your receiver
<action android:name="android.bluetooth.adapter.action.STATE_CHANGED" />
<action android:name="android.bluetooth.device.action.UUID" />
<action android:name="android.bluetooth.device.action.BOND_STATE_CHANGED" />
permissions to be given
<uses-permission android:name="android.permission.BLUETOOTH" />

SKT
- 1,821
- 1
- 20
- 32
-
1Can you provide little code snippet of broadcast receiver? I'm stuck with this and dont know how to launch the app.. – YuDroid Feb 13 '14 at 13:23
-
for details see this Q/A http://stackoverflow.com/questions/8073053/launch-application-when-device-turn-on-or-unlocked – teejay Dec 20 '14 at 13:28