You need to create a
BroadcastReceiver
and listen for the even
RECEIVE_BOOT_COMPLETED
.
That will require your application to have permission
android.permission.RECEIVE_BOOT_COMPLETE.
public class MyBootListener extends BroadcastReceiver {
@Override
public void onReceive(final Context context, final Intent intent) {
final Intent startServiceIntent = new Intent(context, MyService.class);
context.startService(startServiceIntent);
}
}
Here's an example showing how to
auto start an Activity[
^] that you should be able to change to start your service.
Hope this helps,
Fredrik