0

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!?

NcmX
  • 25
  • 1
  • 5
  • Did you made this to work correctly? Can you provide little code snippet of broadcast receiver? I'm stuck with this and dont know how to launch the app.. I would be grateful.. – YuDroid Feb 13 '14 at 13:24

1 Answers1

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
  • 1
    Can 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