ekasetiawans / flutter_background_service

269 stars 189 forks source link

App is crashing after updating targetsdkversion to 34 #480

Open Sunilk047 opened 1 month ago

pratikcronabit commented 1 month ago

I have one solution.

1)- Please make sure your project already use the version of gradle tools below:

in android/build.gradle classpath 'com.android.tools.build:gradle:7.4.2' in android/build.gradle ext.kotlin_version = '1.8.10' in android/gradle/wrapper/gradle-wrapper.properties distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip

2)- Add the corresponding permission to your android/app/src/main/AndroidManifest.xml file:

Add Permission

<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_..." />

Ex.. :-, if you picked 'location', use 'android.permission.FOREGROUND_SERVICE_LOCATION' ............Read more https://developer.android.com/about/versions/14/changes/fgs-types-required

    <service
        android:name="id.flutter.flutter_background_service.BackgroundService"
        android:foregroundServiceType="WhatForegroundServiceTypeDoYouWant"
    />

That is work for me. Thanks.