new: custom foreground service on Android (#556)

This commit is contained in:
lollipopkit🏳️‍⚧️
2024-08-28 16:42:09 +08:00
committed by GitHub
parent 479250c207
commit 2d9dc044f9
6 changed files with 95 additions and 75 deletions

View File

@@ -1,4 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<manifest xmlns:tools="http://schemas.android.com/tools"
xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
@@ -15,7 +16,8 @@
android:icon="@mipmap/ic_launcher"
android:allowBackup="true"
android:hasFragileUserData="true"
android:restoreAnyVersion="true">
android:restoreAnyVersion="true"
tools:targetApi="q">
<activity
android:name=".MainActivity"
android:exported="true"
@@ -43,11 +45,6 @@
android:name="flutterEmbedding"
android:value="2" />
<service
android:name="id.flutter.flutter_background_service.BackgroundService"
android:foregroundServiceType="dataSync"
/>
<receiver
android:name=".widget.HomeWidget"
android:exported="false"
@@ -68,8 +65,9 @@
</receiver>
<service
android:name=".MyForegroundService"
android:name=".ForegroundService"
android:enabled="true"
android:foregroundServiceType="dataSync"
android:exported="false" />
</application>