ixx
ixx

Reputation: 32273

Android broadcast receiver running always

How do I make a broadcast receiver which runs always, from the very start of the device? Is this possible without starting the application where it is declared?

If not I guess I would have to start my application when the device starts. But this probably adds to much overhead and it's unwanted.

I want this always runnning broadcast receiver in order to listen always for c2dm notifications. These should notify the user that there are new messages in the application.

Upvotes: 0

Views: 2232

Answers (2)

SeanPONeil
SeanPONeil

Reputation: 3910

If you add the BroadcastReceiver to your Manifest with an Intent Filter to listen for a specific intent, the Receiver will be active upon install.

Upvotes: 1

android developer
android developer

Reputation: 116362

what do you mean "run always" ?

if you need something to be alive for a long time , and from the OS bootup , you need to :

  1. let the app to be installed only on the internal storage (otherwise it won't work).

  2. set the broadcast receiver to listen to the boot intent .

  3. upon receiving the boot intent, start a service and there listen to the intent you wish to listen to.

Upvotes: 0

Related Questions