JulianAssmann / flutter_background

A flutter plugin to keep apps running in the background via foreground services. Android only.
https://pub.dev/packages/flutter_background
MIT License
85 stars 45 forks source link

[BUG] Error when targeting Android S+ #44

Closed Wackymax closed 2 years ago

Wackymax commented 2 years ago

Describe the bug When targeting Android S+ and requesting the background service to enable the following error is thrown:

E/AndroidRuntime( 6181): Caused by: java.lang.IllegalArgumentException: com.flygaggle.flutterapp: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent.
E/AndroidRuntime( 6181): Strongly consider using FLAG_IMMUTABLE, only use FLAG_MUTABLE if some functionality depends on the PendingIntent being mutable, e.g. if it needs to be used with inline replies or bubbles.
E/AndroidRuntime( 6181):    at android.app.PendingIntent.checkFlags(PendingIntent.java:375)
E/AndroidRuntime( 6181):    at android.app.PendingIntent.getActivityAsUser(PendingIntent.java:458)
E/AndroidRuntime( 6181):    at android.app.PendingIntent.getActivity(PendingIntent.java:444)
E/AndroidRuntime( 6181):    at android.app.PendingIntent.getActivity(PendingIntent.java:408)
E/AndroidRuntime( 6181):    at de.julianassmann.flutter_background.IsolateHolderService.onCreate(IsolateHolderService.kt:49)
E/AndroidRuntime( 6181):    at android.app.ActivityThread.handleCreateService(ActivityThread.java:4491)