Issue
I wtitten code by flutter for mobile application
Future _showNotificationRequest() async {
var androidPlatformChannelSpecifics = new AndroidNotificationDetails(
'your channel id', 'your channel name', 'your channel description',
playSound: true,
importance: Importance.Max,
priority: Priority.High,
ticker: 'ticker');
var iOSPlatformChannelSpecifics =
new IOSNotificationDetails(presentSound: false);
var platformChannelSpecifics = new NotificationDetails(
androidPlatformChannelSpecifics, iOSPlatformChannelSpecifics);
await flutterLocalNotificationsPlugin.show(
0,
'Новые заявки',
'Обновите список заявок',
platformChannelSpecifics,
payload: 'No_Sound',
);
}
After change SDK on version 31, because Google Play doesn`t publish my app
compileSdkVersion 31
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "kz.vashdomofon.ksu"
minSdkVersion 22
targetSdkVersion 31
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
An error occurred while executing this method
D/CompatibilityChangeReporter(29530): Compat change id reported: 160794467; UID 10146; state: ENABLED
E/MethodChannel#dexterous.com/flutter/local_notifications(29530): Failed to handle method call
E/MethodChannel#dexterous.com/flutter/local_notifications(29530): java.lang.IllegalArgumentException: kz.vashdomofon.ksu: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent.
E/MethodChannel#dexterous.com/flutter/local_notifications(29530): 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/MethodChannel#dexterous.com/flutter/local_notifications(29530): at android.app.PendingIntent.checkFlags(PendingIntent.java:375)
E/MethodChannel#dexterous.com/flutter/local_notifications(29530): at android.app.PendingIntent.getActivityAsUser(PendingIntent.java:458)
E/MethodChannel#dexterous.com/flutter/local_notifications(29530): at android.app.PendingIntent.getActivity(PendingIntent.java:444)
E/MethodChannel#dexterous.com/flutter/local_notifications(29530): at android.app.PendingIntent.getActivity(PendingIntent.java:408)
E/MethodChannel#dexterous.com/flutter/local_notifications(29530): at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.createNotification(FlutterLocalNotificationsPlugin.java:134)
E/MethodChannel#dexterous.com/flutter/local_notifications(29530): at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.showNotification(FlutterLocalNotificationsPlugin.java:688)
E/MethodChannel#dexterous.com/flutter/local_notifications(29530): at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.show(FlutterLocalNotificationsPlugin.java:827)
E/MethodChannel#dexterous.com/flutter/local_notifications(29530): at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.onMethodCall(FlutterLocalNotificationsPlugin.java:750)
E/MethodChannel#dexterous.com/flutter/local_notifications(29530): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:233)
E/MethodChannel#dexterous.com/flutter/local_notifications(29530): at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:84)
E/MethodChannel#dexterous.com/flutter/local_notifications(29530): at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:865)
E/MethodChannel#dexterous.com/flutter/local_notifications(29530): at android.os.MessageQueue.nativePollOnce(Native Method)
E/MethodChannel#dexterous.com/flutter/local_notifications(29530): at android.os.MessageQueue.next(MessageQueue.java:335)
E/MethodChannel#dexterous.com/flutter/local_notifications(29530): at android.os.Looper.loopOnce(Looper.java:161)
E/MethodChannel#dexterous.com/flutter/local_notifications(29530): at android.os.Looper.loop(Looper.java:288)
E/MethodChannel#dexterous.com/flutter/local_notifications(29530): at android.app.ActivityThread.main(ActivityThread.java:7839)
E/MethodChannel#dexterous.com/flutter/local_notifications(29530): at java.lang.reflect.Method.invoke(Native Method)
E/MethodChannel#dexterous.com/flutter/local_notifications(29530): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
E/MethodChannel#dexterous.com/flutter/local_notifications(29530): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
E/MethodChannel#dexterous.com/flutter/local_notifications(29530): Failed to handle method call
E/MethodChannel#dexterous.com/flutter/local_notifications(29530): java.lang.IllegalArgumentException: kz.vashdomofon.ksu: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent.
E/MethodChannel#dexterous.com/flutter/local_notifications(29530): 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/MethodChannel#dexterous.com/flutter/local_notifications(29530): at android.app.PendingIntent.checkFlags(PendingIntent.java:375)
E/MethodChannel#dexterous.com/flutter/local_notifications(29530): at android.app.PendingIntent.getActivityAsUser(PendingIntent.java:458)
E/MethodChannel#dexterous.com/flutter/local_notifications(29530): at android.app.PendingIntent.getActivity(PendingIntent.java:444)
E/MethodChannel#dexterous.com/flutter/local_notifications(29530): at android.app.PendingIntent.getActivity(PendingIntent.java:408)
E/MethodChannel#dexterous.com/flutter/local_notifications(29530): at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.createNotification(FlutterLocalNotificationsPlugin.java:134)
E/MethodChannel#dexterous.com/flutter/local_notifications(29530): at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.showNotification(FlutterLocalNotificationsPlugin.java:688)
E/MethodChannel#dexterous.com/flutter/local_notifications(29530): at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.show(FlutterLocalNotificationsPlugin.java:827)
E/MethodChannel#dexterous.com/flutter/local_notifications(29530): at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.onMethodCall(FlutterLocalNotificationsPlugin.java:750)
E/MethodChannel#dexterous.com/flutter/local_notifications(29530): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:233)
E/MethodChannel#dexterous.com/flutter/local_notifications(29530): at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:84)
E/MethodChannel#dexterous.com/flutter/local_notifications(29530): at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:865)
E/MethodChannel#dexterous.com/flutter/local_notifications(29530): at android.os.MessageQueue.nativePollOnce(Native Method)
E/MethodChannel#dexterous.com/flutter/local_notifications(29530): at android.os.MessageQueue.next(MessageQueue.java:335)
E/MethodChannel#dexterous.com/flutter/local_notifications(29530): at android.os.Looper.loopOnce(Looper.java:161)
E/MethodChannel#dexterous.com/flutter/local_notifications(29530): at android.os.Looper.loop(Looper.java:288)
E/MethodChannel#dexterous.com/flutter/local_notifications(29530): at android.app.ActivityThread.main(ActivityThread.java:7839)
E/MethodChannel#dexterous.com/flutter/local_notifications(29530): at java.lang.reflect.Method.invoke(Native Method)
E/MethodChannel#dexterous.com/flutter/local_notifications(29530): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
E/MethodChannel#dexterous.com/flutter/local_notifications(29530): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
E/flutter (29530): [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: PlatformException(error, kz.vashdomofon.ksu: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent.
E/flutter (29530): 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., null, java.lang.IllegalArgumentException: kz.vashdomofon.ksu: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent.
E/flutter (29530): 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/flutter (29530): at android.app.PendingIntent.checkFlags(PendingIntent.java:375)
E/flutter (29530): at android.app.PendingIntent.getActivityAsUser(PendingIntent.java:458)
E/flutter (29530): at android.app.PendingIntent.getActivity(PendingIntent.java:444)
E/flutter (29530): at android.app.PendingIntent.getActivity(PendingIntent.java:408)
E/flutter (29530): at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.createNotification(FlutterLocalNotificationsPlugin.java:134)
E/flutter (29530): at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.showNotification(FlutterLocalNotificationsPlugin.java:688)
E/flutter (29530): at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.show(FlutterLocalNotificationsPlugin.java:827)
E/flutter (29530): at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.onMethodCall(FlutterLocalNotificationsPlugin.java:750)
E/flutter (29530): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:233)
E/flutter (29530): at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:84)
E/flutter (29530): at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:865)
E/flutter (29530): at android.os.MessageQueue.nativePollOnce(Native Method)
E/flutter (29530): at android.os.MessageQueue.next(MessageQueue.java:335)
E/flutter (29530): at android.os.Looper.loopOnce(Looper.java:161)
E/flutter (29530): at android.os.Looper.loop(Looper.java:288)
E/flutter (29530): at android.app.ActivityThread.main(ActivityThread.java:7839)
E/flutter (29530): at java.lang.reflect.Method.invoke(Native Method)
E/flutter (29530): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
E/flutter (29530): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
E/flutter (29530): )
E/flutter (29530): #0 StandardMethodCodec.decodeEnvelope
E/flutter (29530): #1 MethodChannel._invokeMethod
E/flutter (29530): <asynchronous suspension>
E/flutter (29530): #2 FlutterLocalNotificationsPlugin.show
E/flutter (29530): <asynchronous suspension>
E/flutter (29530): #3 _KSU._showNotificationRequest
E/flutter (29530): <asynchronous suspension>
E/flutter (29530):
E/flutter (29530): [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: PlatformException(error, kz.vashdomofon.ksu: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent.
E/flutter (29530): 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., null, java.lang.IllegalArgumentException: kz.vashdomofon.ksu: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent.
E/flutter (29530): 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/flutter (29530): at android.app.PendingIntent.checkFlags(PendingIntent.java:375)
E/flutter (29530): at android.app.PendingIntent.getActivityAsUser(PendingIntent.java:458)
E/flutter (29530): at android.app.PendingIntent.getActivity(PendingIntent.java:444)
E/flutter (29530): at android.app.PendingIntent.getActivity(PendingIntent.java:408)
E/flutter (29530): at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.createNotification(FlutterLocalNotificationsPlugin.java:134)
E/flutter (29530): at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.showNotification(FlutterLocalNotificationsPlugin.java:688)
E/flutter (29530): at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.show(FlutterLocalNotificationsPlugin.java:827)
E/flutter (29530): at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.onMethodCall(FlutterLocalNotificationsPlugin.java:750)
E/flutter (29530): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:233)
E/flutter (29530): at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:84)
E/flutter (29530): at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:865)
E/flutter (29530): at android.os.MessageQueue.nativePollOnce(Native Method)
E/flutter (29530): at android.os.MessageQueue.next(MessageQueue.java:335)
E/flutter (29530): at android.os.Looper.loopOnce(Looper.java:161)
E/flutter (29530): at android.os.Looper.loop(Looper.java:288)
E/flutter (29530): at android.app.ActivityThread.main(ActivityThread.java:7839)
E/flutter (29530): at java.lang.reflect.Method.invoke(Native Method)
E/flutter (29530): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
E/flutter (29530): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
E/flutter (29530): )
E/flutter (29530): #0 StandardMethodCodec.decodeEnvelope
E/flutter (29530): #1 MethodChannel._invokeMethod
E/flutter (29530): <asynchronous suspension>
E/flutter (29530): #2 FlutterLocalNotificationsPlugin.show
E/flutter (29530): <asynchronous suspension>
E/flutter (29530): #3 _KSU._showNotificationPPR
E/flutter (29530): <asynchronous suspension>
I did not find how to fix this error, or the solutions were not suitable for my case. Can someone tell me where to look.
I tried add FLAG_MUTABLE or FALG_IMMUTABLE in MainActivity.kt, but intent out of method scope
Solution
Problem-solving by upgrading flutter, packages and gradle
Answered By - vajarkov
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.