Автозапуск мобильного приложения на flutter после загрузки android
Пробовал разные примеры со StackOverflow по данной теме, но приложение не стартует сразу после загрузки OS Android. Причем не нашел пакета под flutter, который позволяет сделать загрузку приложения автоматической после запуска android. Приходится забираться под капот, в java код, но там я не преуспел. Примеры устаревшие. Максимум 2019 года, хотя темя вроде бы должна быть актуальной. Если кто-то обладает информацией о пакете для flutter или может посоветовать репо с рабочим кодом java, но именно для flutter, буду очень благодарен
мой AndroidManifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.untitled">
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<application
android:label="untitled"
android:icon="@mipmap/ic_launcher">
<activity
android:name=".MainActivity"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">
<!-- Specifies an Android theme to apply to this Activity as soon as
the Android process has started. This theme is visible to the user
while the Flutter UI initializes. After that, this theme continues
to determine the Window background behind the Flutter UI. -->
<meta-data
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="@style/NormalTheme"
/>
<!-- Displays an Android View that continues showing the launch screen
Drawable until Flutter paints its first frame, then this splash
screen fades out. A splash screen is useful to avoid any visual
gap between the end of Android's launch screen and the painting of
Flutter's first frame. -->
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<receiver android:name=".MyBoot">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED"/>
</intent-filter>
</receiver>
<meta-data
android:name="flutterEmbedding"
android:value="2" />
</application>
</manifest>
java-класс, который наследуется от BroadcastReceiver
package com.example.untitled;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
public class MyBoot extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
if (Intent.ACTION_BOOT_COMPLETED.equals(intent.getAction())) {
Intent in = new Intent(context, MainActivity.class);
in.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(in);
}
}
}
и MainActivity
package com.example.untitled;
import io.flutter.embedding.android.FlutterActivity;
public class MainActivity extends FlutterActivity {
}
update. на эмуляторе AVD manager виртуальный смартфон один раз нормально загружает билд, а при перезагрузке уходит в циклический ребут