Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java.lang.IllegalStateException: Maximum limit of concurrent alarms 500 #1914

Closed
zzzhhhhh001 opened this issue Mar 8, 2023 · 2 comments
Closed

Comments

@zzzhhhhh001
Copy link

I used flutter_local_notifications to send notifications, and I used the loop to add 880 notifications at a time with the following error.

E/flutter (29456): [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: PlatformException(error, Maximum limit of concurrent alarms 500 reached for uid: u0a201, callingPackage: com.kk.flutter_kk, null, java.lang.IllegalStateException: Maximum limit of concurrent alarms 500 reached for uid: u0a201, callingPackage: com.kk.flutter_kk
E/flutter (29456): at android.os.Parcel.createExceptionOrNull(Parcel.java:2381)
E/flutter (29456): at android.os.Parcel.createException(Parcel.java:2357)
E/flutter (29456): at android.os.Parcel.readException(Parcel.java:2340)
E/flutter (29456): at android.os.Parcel.readException(Parcel.java:2282)
E/flutter (29456): at android.app.IAlarmManager$Stub$Proxy.set(IAlarmManager.java:301)
E/flutter (29456): at android.app.AlarmManager.setImpl(AlarmManager.java:696)
E/flutter (29456): at android.app.AlarmManager.setExact(AlarmManager.java:541)
E/flutter (29456): at androidx.core.app.AlarmManagerCompat.setExact(AlarmManagerCompat.java:165)
E/flutter (29456): at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.scheduleNotification(FlutterLocalNotificationsPlugin.java:416)
E/flutter (29456): at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.schedule(FlutterLocalNotificationsPlugin.java:1354)
E/flutter (29456): at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.onMethodCall(FlutterLocalNotificationsPlugin.java:1248)
E/flutter (29456): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:262)
E/flutter (29456): at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:296)
E/flutter (29456): at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$DartMessenger(DartMessenger.java:320)
E/flutter (29456): at io.flutter.embedding.engine.dart.-$$Lambda$DartMessenger$TsixYUB5E6FpKhMtCSQVHKE89gQ.run(Unknown Source:12)
E/flutter (29456): at android.os.Handler.handleCallback(Handler.java:938)
E/flutter (29456): at android.os.Handler.dispatchMessage(Handler.java:99)
E/flutter (29456): at android.os.Looper.loop(Looper.java:223)
E/flutter (29456): at android.app.ActivityThread.main(ActivityThread.java:7656)
E/flutter (29456): at java.lang.reflect.Method.invoke(Native Method)
E/flutter (29456): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
E/flutter (29456): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
E/flutter (29456): )
E/flutter (29456): #0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:607:7)
E/flutter (29456): #1 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:177:18)
E/flutter (29456):
E/flutter (29456): #2 AndroidFlutterLocalNotificationsPlugin.schedule (package:flutter_local_notifications/src/platform_flutter_local_notifications.dart:127:5)
E/flutter (29456):
E/flutter (29456): #3 FlutterLocalNotificationsPlugin.schedule (package:flutter_local_notifications/src/flutter_local_notifications_plugin.dart:291:7)
E/flutter (29456):
E/flutter (29456): #4 _TaskEditDelete0Page.scheduleAlarm (package:flutter_kk/pages/taskedit_page_delete0.dart:6226:5)
E/flutter (29456):
E/flutter (29456):
E/MethodChannel#dexterous.com/flutter/local_notifications(29456): Failed to handle method call
E/MethodChannel#dexterous.com/flutter/local_notifications(29456): java.lang.IllegalStateException: Maximum limit of concurrent alarms 500 reached for uid: u0a201, callingPackage: com.kk.flutter_kk
E/MethodChannel#dexterous.com/flutter/local_notifications(29456): at android.os.Parcel.createExceptionOrNull(Parcel.java:2381)
E/MethodChannel#dexterous.com/flutter/local_notifications(29456): at android.os.Parcel.createException(Parcel.java:2357)
E/MethodChannel#dexterous.com/flutter/local_notifications(29456): at android.os.Parcel.readException(Parcel.java:2340)
E/MethodChannel#dexterous.com/flutter/local_notifications(29456): at android.os.Parcel.readException(Parcel.java:2282)
E/MethodChannel#dexterous.com/flutter/local_notifications(29456): at android.app.IAlarmManager$Stub$Proxy.set(IAlarmManager.java:301)
E/MethodChannel#dexterous.com/flutter/local_notifications(29456): at android.app.AlarmManager.setImpl(AlarmManager.java:696)
E/MethodChannel#dexterous.com/flutter/local_notifications(29456): at android.app.AlarmManager.setExact(AlarmManager.java:541)
E/MethodChannel#dexterous.com/flutter/local_notifications(29456): at androidx.core.app.AlarmManagerCompat.setExact(AlarmManagerCompat.java:165)
E/MethodChannel#dexterous.com/flutter/local_notifications(29456): at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.scheduleNotification(FlutterLocalNotificationsPlugin.java:416)
E/MethodChannel#dexterous.com/flutter/local_notifications(29456): at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.schedule(FlutterLocalNotificationsPlugin.java:1354)
E/MethodChannel#dexterous.com/flutter/local_notifications(29456): at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.onMethodCall(FlutterLocalNotificationsPlugin.java:1248)
E/MethodChannel#dexterous.com/flutter/local_notifications(29456): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:262)
E/MethodChannel#dexterous.com/flutter/local_notifications(29456): at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:296)
E/MethodChannel#dexterous.com/flutter/local_notifications(29456): at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$DartMessenger(DartMessenger.java:320)
E/MethodChannel#dexterous.com/flutter/local_notifications(29456): at io.flutter.embedding.engine.dart.-$$Lambda$DartMessenger$TsixYUB5E6FpKhMtCSQVHKE89gQ.run(Unknown Source:12)
E/MethodChannel#dexterous.com/flutter/local_notifications(29456): at android.os.Handler.handleCallback(Handler.java:938)
E/MethodChannel#dexterous.com/flutter/local_notifications(29456): at android.os.Handler.dispatchMessage(Handler.java:99)
E/MethodChannel#dexterous.com/flutter/local_notifications(29456): at android.os.Looper.loop(Looper.java:223)
E/MethodChannel#dexterous.com/flutter/local_notifications(29456): at android.app.ActivityThread.main(ActivityThread.java:7656)
E/MethodChannel#dexterous.com/flutter/local_notifications(29456): at java.lang.reflect.Method.invoke(Native Method)
E/MethodChannel#dexterous.com/flutter/local_notifications(29456): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
E/MethodChannel#dexterous.com/flutter/local_notifications(29456): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)

@MaikuB
Copy link
Owner

MaikuB commented Mar 16, 2023

This looks like it's to do with what was documented at https://github.com/MaikuB/flutter_local_notifications/tree/master/flutter_local_notifications#scheduled-android-notifications and there's isn't anything else the plugin can do as it's a limitation of the OS. You may need to consider if there's a different solution to your problem e.g. if using a calendar plugin is more appropriate.

Note whilst zoneScheduled() would also have this problem, should point out that schedule() is deprecated and won't be maintained

@pritish-thub
Copy link

This will help https://www.youtube.com/watch?v=aQTvI8L-mZs

@MaikuB MaikuB closed this as completed Mar 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants