3

I saw same questions like: link1 link2, but my Flutter version is newer than as in resolves or something else, so my Flutter bases on Kotlin, not Java, as I think. MainActivity exists only in kotlin directory, in Java there is only GeneratedPluginRegistrant.java

My directory to MainActivity bases in android/app/src/main/kotlin/com/name/app_name/MainActivity.kt

I tried to add my StartCmPlayerServiceAtBootReceiver.kt in directory above as in solutions in links, and added code below to AndroidManifest, which is in android/app/src/main/

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />

and this before closing tag of

<receiver
    android:enabled="true"
    android:name=".StartCmPlayerServiceAtBootReceiver">
    <intent-filter>
        <action android:name="android.intent.action.BOOT_COMPLETED" />
    </intent-filter>
</receiver>

So, are there any other solutions? Flutter version 2.2.3

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
Altereyo
  • 51
  • 5
  • Does this answer your question? [Autostart on BOOT\_COMPLETED for flutter application based on Android example not working](https://stackoverflow.com/questions/53715839/autostart-on-boot-completed-for-flutter-application-based-on-android-example-not) – Nuwan Thisara Oct 09 '21 at 05:03

0 Answers0