I am trying to automatically start an Android service when the device reboots. I have tried to accomplish this using Receive_Boot_Complete permission, BroadcastReceiver with Boot_Complete intent action with no success. I'm very well aware that after Android 3.0 apps are placed in a stopped state on reboot and therefore no receivers are able to run. However, there are several mobile security apps such as Lookout that are run services and processes on reboot. How are they able to accomplish this?
<!-- Listen for the device starting up -->
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
<receiver android:name="com.tpss.beacon.BootCompleteReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED"/>
<action android:name="android.intent.action.QUICKBOOT_POWERON" />
</intent-filter>
</receiver>
public class BootCompleteReceiver extends BroadcastReceiver{
@Override
public void onReceive(Context context, Intent intent) {
context.startService(new Intent(context, UpdateGeofenceService.class));
}
}