How would I programmatically determine when an android device has rebooted (whether on its own, or user initiated) ?
This snippet starts an Application automatically after the android-os booted up.
in AndroidManifest.xml (application-part):
// You must hold the RECEIVE_BOOT_COMPLETED permission in order to receive this broadcast.
[..]
[..]
In Java Class
public class BootUpReceiver extends BroadcastReceiver{
@Override
public void onReceive(Context context, Intent intent) {
Intent i = new Intent(context, MyActivity.class);
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(i);
}
}