-1

In my application I'm using the Estimote Beacon API. In order to start the ranging service, the user must start the application (the most obvious thing...) but, i was wondering if it were possible to avoid this user interaction by automating the start of the application.

A rough idea could be:

Keep the estimote ranging service running even if the application is closed. As soon as a beacon is detected, generate an Intent broadcast that will be captured by a BroadcastReceiver that in turn will start the Main Activity (maybe a notification could be sent to the user and the activity remains hidden).

1) Is that possible? 2) Is it a correct design choice?

Thank you very much for your help.

John
  • 6,433
  • 7
  • 47
  • 82
Loris
  • 454
  • 7
  • 19

1 Answers1

0

This behaviour is exactly what the Service class is for.

I use this solution for media players where a Widget can interact with the Service without the need for a full blown Activity to be created.

John
  • 6,433
  • 7
  • 47
  • 82
  • It could not be so easy. Maybe i don't know exactly how to do it. I want to avoid to explicitly open the application. – Loris Oct 11 '15 at 13:28
  • 1
    If you don't open the application you will have no `Context` to launch an `Intent` from, you at least need a `Widget` which can be set to periodically launch and perform a simple task. For anything more complicated a `Service` would be advisable, and a darn site easier to debug. – John Oct 11 '15 at 13:31