How to start a service when my device boots up on Android

439630 pts.
Tags:
Android
Mobile
I'm looking to start a service when my device boots up on Android but I can't seem to get it to work. Here's the code I'm working with:
<receiverandroid:name=".StartServiceAtBootReceiver"android:enabled="true"android:exported="false"android:label="StartServiceAtBootReceiver"><intent-filter><actionandroid:name="android.intent.action._BOOT_COMPLETED"/></intent-filter></receiver><serviceandroid:name="com.test.RunService"android:enabled="true"/>
And this is the second part: public void onReceive(Context context, Intent intent) { if ("android.intent.action.BOOT_COMPLETED".equals(intent.getAction())) { Intent serviceLauncher = new Intent(context, RunService.class); context.startService(serviceLauncher); Log.v("TEST", "Service loaded at start"); } } Is there something I'm missing?

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.

Following

Share this item with your network: