I\'d like to start my app just after the phone boot. Apparently the app is started after the boot but it immediately crashes (just to be clear the app normally works fine).
Try this:
1] In AndroidManifest.xml file:
2] Inside BroadcastReciever class with StartMyActivityAtBootReceiver as class name.
@Override
public void onReceive(Context context, Intent intent) {
Intent i = new Intent(context, MainActivity.class);
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(i);
}
This worked for me. The difference in code is as follows: