title: Android 10.0 Application startup on BOOT
body: <p>We have an android application which we intend to start/launch during phone boot.
  With some code tries in Android 10, we realized that the launching of app on boot, is not possible after Android 8.0. Previously in Android 6, it was possible.
  Even in physical device /phone / emulator Android 10 , we gave permission in AutoStart list our application.
  &lt;&lt; Objective: Any way (workaround) to launch app on boot even on latest versions , i.e. Android 8 onwards ? &gt;&gt;</p>
  <p>Tries that we made in Android 10: following are 3 sections of code - AndroidManifest.xml, MyActivity.java, MyBroadcastReceiver.java</p>
  <p>1)AndroidManifest.xml</p>
  <pre><code>&lt;uses-permission android:name=&quot;android.permission.RECEIVE_BOOT_COMPLETED&quot; /&gt;&lt;uses-permission android:name=&quot;android.permission.SYSTEM_ALERT_WINDOW&quot;/&gt;
  &lt;activity android:name=&quot;.MainActivity&quot;  android:launchMode=&quot;singleTop&quot; android:theme=&quot;@style/LaunchTheme&quot;
  android:configChanges=&quot;orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode&quot;
  android:hardwareAccelerated=&quot;true&quot; android:windowSoftInputMode=&quot;adjustResize&quot;&gt;
  &lt;intent-filter&gt;
  &lt;action android:name=&quot;android.intent.action.MAIN&quot;/&gt;
  &lt;category android:name=&quot;android.intent.category.LAUNCHER&quot;/&gt;
  &lt;/intent-filter&gt;
  &lt;/activity&gt;
  &lt;receiver android:name=&quot;.MyBroadcastReceiver&quot; android:enabled=&quot;true&quot; android:exported=&quot;true&quot; android:permission=&quot;android.permission.RECEIVE_BOOT_COMPLETED&quot; &gt;
  &lt;intent-filter&gt;
  &lt;action android:name=&quot;android.intent.action.BOOT_COMPLETED&quot;/&gt;
  &lt;/intent-filter&gt;
  &lt;/receiver&gt;
  </code></pre>
  <p>2)MyActivity.java</p>
  <pre><code>public class MainActivity extends FlutterActivity {
  @java.lang.Override
  protected void onCreate(android.os.Bundle savedInstanceState) { 
  super.onCreate(savedInstanceState);
  // &quot;Display pop up window&quot;
      if (!Settings.canDrawOverlays(getApplicationContext())) {
          startActivity(new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION));
      }
  Log.d(TAG, &quot;-------- onCreate -------&quot;); // this is printed
  }
  }
  </code></pre>
  <p>3)MyBroadcastReceiver.java</p>
  <pre><code>public class MyBroadcastReceiver extends BroadcastReceiver {
  @Override
  public void onReceive(Context context, Intent intent) {
  if (Intent.ACTION_BOOT_COMPLETED.equals(intent.getAction())) {
  Intent i = new Intent(context, MainActivity.class);
  i.setAction(Intent.ACTION_MAIN);
  i.addCategory(Intent.CATEGORY_LAUNCHER);
  i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
  context.startActivity(i);
  Log.d(TAG, &quot;------ tried to launch MainActivity -------&quot;); // this is printed
  }
  }
  }
  </code></pre>