flutter_local_notifications icon indicating copy to clipboard operation
flutter_local_notifications copied to clipboard

19.0.0 cancel notification

Open Poloten opened this issue 8 months ago • 0 comments

Describe the bug

E/MethodChannel#dexterous.com/flutter/local_notifications( 8821): Failed to handle method call
E/MethodChannel#dexterous.com/flutter/local_notifications( 8821): java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.content.Context.getPackageName()' on a null object reference
E/MethodChannel#dexterous.com/flutter/local_notifications( 8821): 	at android.content.ComponentName.<init>(ComponentName.java:132)
E/MethodChannel#dexterous.com/flutter/local_notifications( 8821): 	at android.content.Intent.<init>(Intent.java:7451)
E/MethodChannel#dexterous.com/flutter/local_notifications( 8821): 	at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.cancelNotification(FlutterLocalNotificationsPlugin.java:1770)
E/MethodChannel#dexterous.com/flutter/local_notifications( 8821): 	at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.cancel(FlutterLocalNotificationsPlugin.java:1589)
E/MethodChannel#dexterous.com/flutter/local_notifications( 8821): 	at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.onMethodCall(FlutterLocalNotificationsPlugin.java:1485)
E/MethodChannel#dexterous.com/flutter/local_notifications( 8821): 	at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:267)
E/MethodChannel#dexterous.com/flutter/local_notifications( 8821): 	at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:292)
E/MethodChannel#dexterous.com/flutter/local_notifications( 8821): 	at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$io-flutter-embedding-engine-dart-DartMessenger(DartMessenger.java:319)
E/MethodChannel#dexterous.com/flutter/local_notifications( 8821): 	at io.flutter.embedding.engine.dart.DartMessenger$$ExternalSyntheticLambda0.run(D8$$SyntheticClass:0)
E/MethodChannel#dexterous.com/flutter/local_notifications( 8821): 	at android.os.Handler.handleCallback(Handler.java:942)
E/MethodChannel#dexterous.com/flutter/local_notifications( 8821): 	at android.os.Handler.dispatchMessage(Handler.java:99)
E/MethodChannel#dexterous.com/flutter/local_notifications( 8821): 	at android.os.Looper.loopOnce(Looper.java:201)
E/MethodChannel#dexterous.com/flutter/local_notifications( 8821): 	at android.os.Looper.loop(Looper.java:288)
E/MethodChannel#dexterous.com/flutter/local_notifications( 8821): 	at android.app.ActivityThread.main(ActivityThread.java:7924)
E/MethodChannel#dexterous.com/flutter/local_notifications( 8821): 	at java.lang.reflect.Method.invoke(Native Method)
E/MethodChannel#dexterous.com/flutter/local_notifications( 8821): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
E/MethodChannel#dexterous.com/flutter/local_notifications( 8821): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
W/FlutterJNI( 8821): Tried to send a platform message response, but FlutterJNI was detached from native C++. Could not send. Response ID: 31 

To Reproduce In background when try to cancel notification

List<ActiveNotification> activeList = await flutterLocalNotificationsPlugin.getActiveNotifications();
  if (activeList.isEmpty) return;
  for (var item in activeList) {
    await flutterLocalNotificationsPlugin.cancel(item.id!, tag: item.tag);
  } 

activeList - is not empty

Poloten avatar Apr 01 '25 16:04 Poloten