-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Crash: Attempt to invoke virtual method 'boolean com.dexterous.flutterlocalnotifications.models.ScheduleMode.useAllowWhileIdle()' on a null object reference #2136
Comments
Do you have info on what is the earliest version of the plugin that your app used? I can't see how this is has happened unless at some point, your app didn't configure Proguard rules properly and caused the value for |
As far as I could see in my releases, the very first version added was 3.0.3. I have forked the plugin and and handled the null case, same as you had done for #2033 and #2041. This solved my issue. Currently not getting any crashes with the forked plugin. I have added null check in setupAlarm() method which is being called from zonedScheduleNotification() in FlutterLocalNotificationsPlugin.java. It would be really helpful if this null check code can be added in setupAlarm method in future release of the plugin.
|
Whilst I understand the reason why you say that, this won't be done as this is an issue due to misconfiguration that shouldn't have happened otherwise as the allow while idle property was required and code was added that would have mapped an existing value to the new schedule mode property. Trying to add it to the plugin affects all users of the plugin where it's not possible to know whether they had set it to true or false. Putting a code change in would also hide that there was a misconfiguration that should devs should be testing in an app before releasing to users as well and testing that updating one version of an app to a new version should be part of this process. By the way you will need to revisit your code change to ensure it correctly maps the schedule mode property based on your app's choice for the allow while idle property |
Hmm on second thought, open to having this change in as there use to be logic to coalesce a null allow while idle value though in theory that shouldn't happen. Would you be open to submitting a PR on this? |
Thanks a lot. This will be super helpful. I will submit a PR on this. |
I have created a PR for this. Sorry for the delay. I was stuck with few issues. Really appreciate your help.
|
I have updated to version 16.1.0 from version 9.9.1, and I am getting hundreds of background crashes everyday. I am using zonedSchedule method. I have followed all the android setup guidelines in the readme section and have added the Proguard rules.
I am in a fix, can't think of anything else to do. Please help.
This is the background crash I am getting.
In the current version of my app with 16.1.0 version of this library, I have added USE_EXACT_ALARM permission as below. Have followed the android guidelines. [Previous version of my app was using 9.9.1 version of this library, and never faced any crashes.]
multiDexEnabled is true and targeting sdk 33
My zonedSchedule method looks like this
AndroidManifest.xml looks like this
The text was updated successfully, but these errors were encountered: