1

this is more like a general question:

Is it possible to create an app, which starts if your phone connects to a specific bluetooth network?

Is that possible on android? If yes, is there any documentation for a start?

lornz
  • 306
  • 5
  • 16

3 Answers3

3

They use a BroadcastReceiver for bluetooth like in this article, from which you can do whatever you want. (like launching a new activity or whatever)

here's a small stackoverflow thread about this.

Community
  • 1
  • 1
nadavfima
  • 3,012
  • 1
  • 11
  • 9
  • Thanks. This means I can register an BroadcastReceiver and start my app on receiving a special bluetooth event, right?! – lornz Sep 23 '14 at 14:19
  • 1
    pretty much, yea. You'll have to do some more research on accessing the [**Bluetooth**](http://developer.android.com/guide/topics/connectivity/bluetooth.html) on Android though. – nadavfima Sep 23 '14 at 16:10
1

In my opinion it is impossible to do that in that way. Generaly possible is another scenario. Application still works in background and monit if device connect to network. If that happend than can fire another action.

Robert
  • 338
  • 5
  • 16
  • Okay, thank you. There are some apps, which autostart if you connect to your cars bluetooth. any idea how those apps solved it? Do those app run in background all the time? – lornz Sep 23 '14 at 13:17
0

Like nadavfima said, you'll need to use a BroadcastReceiver to listen for Bluetooth connections. When it triggers, you can extract the name of the device that just connected. If that name matches your criteria, then do whatever you want (Launch a new activity etc.)

What they didn't explain is that you need to have your app start a Service, which will register the BroadcastReceiver.

-User installs your app and launches it.

-Button to toggle the service on/off

-User closes your app, but service continues to run

Kevin
  • 33
  • 6