Reputation: 35
Originally, it received the BootComplete Action and tried to start automatically when the app completes booting. However, while checking because startActivity did not work, I found out that context.startActivity executed by the Action received from BoradcastReceiver does not work.
BroadcastReceiver
Intent startIntent = new Intent(context.getApplicationContext(),MainActivity.class);
startIntent.setFlags(FLAG_ACTIVITY_NEW_TASK);
context.startActivity(startIntent);
It's a very simple code that I can't explain, but it gets Received, but the app doesn't start. The existing apps seem to work without problems. It feels like a ghost.
There is a log like this, but I don't know what the problem is.
D/BootReceiver: BootRecived
D/ZLA: Setting app side flag to false due to ActivityStarter-Normal Launch
Upvotes: 0
Views: 59
Reputation: 4446
Please add the following permission to manifest and ask for user permission once when the app opened the first time by calling
startActivity(new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION));
somewhere in your app :
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
Upvotes: 1