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.SecurityException Crash #206

Closed
ghost opened this issue Apr 8, 2019 · 2 comments
Closed

java.lang.SecurityException Crash #206

ghost opened this issue Apr 8, 2019 · 2 comments

Comments

@ghost
Copy link

ghost commented Apr 8, 2019

Describe the bug
I am using this code to schedule daily notification at 10am
but i am receiving alot of crashes in play console

Future scheduleBirthday() async {
    var time = new Time(10, 0, 0);
    var androidPlatformChannelSpecifics = new AndroidNotificationDetails(
      '1997',
      'bla bla bla',
      'bla bla bla.',
      style: AndroidNotificationStyle.Default,
    );
    var iOSPlatformChannelSpecifics = new IOSNotificationDetails();
    var platformChannelSpecifics = new NotificationDetails(
      androidPlatformChannelSpecifics,
      iOSPlatformChannelSpecifics,
    );
    await flutterLocalNotificationsPlugin.showDailyAtTime(
        Constants.currentFlavor.Index,
        'bla bla',
        'bla bla.',
        time,
        platformChannelSpecifics,
        payload: json.encode(NotificationPayload()
            .toJson()));
  }

crash: ( they are dated at 10am too btw)
there are a lot of crashes in the console with the name flutterLocalnotification
i dont mean multiple reports of the same crash,, i mean multiple crashes (every one with multiple reports)
#1 (samsung note9)

Report 1 of 2

java.lang.RuntimeException: 
  at android.app.ActivityThread.handleReceiver (ActivityThread.java:3584)
  at android.app.ActivityThread.access$1300 (ActivityThread.java:235)
  at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1779)
  at android.os.Handler.dispatchMessage (Handler.java:106)
  at android.os.Looper.loop (Looper.java:214)
  at android.app.ActivityThread.main (ActivityThread.java:6981)
  at java.lang.reflect.Method.invoke (Native Method)
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:493)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1445)
Caused by: java.lang.SecurityException: 
  at android.os.Parcel.createException (Parcel.java:1966)
  at android.os.Parcel.readException (Parcel.java:1934)
  at android.os.Parcel.readException (Parcel.java:1884)
  at android.app.IAlarmManager$Stub$Proxy.set (IAlarmManager.java:240)
  at android.app.AlarmManager.setImpl (AlarmManager.java:722)
  at android.app.AlarmManager.setInexactRepeating (AlarmManager.java:823)
  at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.repeatNotification (FlutterLocalNotificationsPlugin.java:283)
  at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.rescheduleNotifications (FlutterLocalNotificationsPlugin.java:110)
  at com.dexterous.flutterlocalnotifications.ScheduledNotificationBootReceiver.onReceive (ScheduledNotificationBootReceiver.java:14)
  at android.app.ActivityThread.handleReceiver (ActivityThread.java:3575)
Caused by: android.os.RemoteException: 
  at com.android.server.SamsungAlarmManagerService.checkMaliciousAppLocked (SamsungAlarmManagerService.java:306)
  at com.android.server.AlarmManagerService.setImpl (AlarmManagerService.java:1739)
  at com.android.server.AlarmManagerService$2.set (AlarmManagerService.java:2081)
  at android.app.IAlarmManager$Stub.onTransact (IAlarmManager.java:92)
  at android.os.Binder.execTransact (Binder.java:739)

crash type #2

java.lang.RuntimeException: 
  at android.app.ActivityThread.handleReceiver (ActivityThread.java:3413)
  at android.app.ActivityThread.-wrap18 (Unknown Source)
  at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1807)
  at android.os.Handler.dispatchMessage (Handler.java:106)
  at android.os.Looper.loop (Looper.java:164)
  at android.app.ActivityThread.main (ActivityThread.java:7000)
  at java.lang.reflect.Method.invoke (Native Method)
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:441)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1408)
Caused by: java.lang.SecurityException: 
  at android.os.Parcel.readException (Parcel.java:2029)
  at android.os.Parcel.readException (Parcel.java:1975)
  at android.app.IAlarmManager$Stub$Proxy.set (IAlarmManager.java:217)
  at android.app.AlarmManager.setImpl (AlarmManager.java:697)
  at android.app.AlarmManager.setInexactRepeating (AlarmManager.java:798)
  at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.repeatNotification (FlutterLocalNotificationsPlugin.java:283)
  at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.rescheduleNotifications (FlutterLocalNotificationsPlugin.java:110)
  at com.dexterous.flutterlocalnotifications.ScheduledNotificationBootReceiver.onReceive (ScheduledNotificationBootReceiver.java:14)
  at android.app.ActivityThread.handleReceiver (ActivityThread.java:3406)
@MaikuB
Copy link
Owner

MaikuB commented Apr 8, 2019

Unless you're able to provide a sample app to reproduce the problem, it'll be difficult to say what is going on. You may need to debug further on your own. I have seen mention of Samsung imposing a limit of 500 alarms via the Alarm Manager API (which is used for scheduling notifications). Perhaps your app has somehow reached that limit

@ghost
Copy link
Author

ghost commented Apr 8, 2019

u are totally right .. it was about the 500 alarms
it seems that even if i create the same notification (same id) ,, it creates another copy of the alarm
which can cause this... i thought scheduling the same notification again isn't a problem ,, but it's with that 500 limit
so i have to call cancel all ,, and keep track of what i already scheduled with sharedperferences for example

very helpful, thank you :)

This issue was closed.
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

1 participant