Rockin
Rockin

Reputation: 743

Restart the service when phone restarts in android

How can I restart my service when phone restarts?

This is what I am currently using to start the service:

Intent a = new Intent();
                a.setAction("com.service.Service");
                startService(a);

Upvotes: 1

Views: 1149

Answers (2)

Harry Joy
Harry Joy

Reputation: 59650

Here is a tutorial for this.

Upvotes: 3

mah
mah

Reputation: 39797

Use a BOOT_COMPLETED broadcast receiver and start the service from within it.

Upvotes: 1

Related Questions