Hundreds of crash reports from Google Play Console after deploying 0.9.0-beta3
See original GitHub issueWARNING: IF YOU IGNORE THIS TEMPLATE, WE’LL IGNORE YOUR ISSUE. YOU MUST FILL THIS IN!
Provide a general summary of the issue.
Your Environment
- Plugin version: 0.9.0-beta3
- Platform: Android
- OS version: 8.1 / 8.0
- Device manufacturer / model: Mostly Pixels
- Cordova version (
cordova -v
): 8.0.0 - Cordova platform version (
cordova platform ls
): cordova-android 6.4.0 - Plugin config
- Ionic Version (if using Ionic) 3.9.2, using the plugin without ionic-native layer
Expected Behavior
Actual Behavior
After deploying an update to the play store a few days ago, I have been getting hundreds of crash reports from Google for devices running Android 8.1. and 8.0 (error attached below). No user complained yet, so I don’t know if the problem has any actual impact. I have tested the app on a Nexus 5X running android 8.1 as well as a few emulators, and I haven’t noticed any issues.
I am reporting this here just so you are aware, in case there is some actual issue.
Steps to Reproduce
Context
Debug logs
This is the error google has been reporting
java.lang.RuntimeException:
at android.app.ActivityThread.handleReceiver (ActivityThread.java:3194)
at android.app.ActivityThread.-wrap17 (Unknown Source)
at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1672)
at android.os.Handler.dispatchMessage (Handler.java:106)
at android.os.Looper.loop (Looper.java:164)
at android.app.ActivityThread.main (ActivityThread.java:6494)
at java.lang.reflect.Method.invoke (Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:807)
Caused by: java.lang.IllegalStateException:
at android.app.ContextImpl.getSharedPreferences (ContextImpl.java:387)
at android.app.ContextImpl.getSharedPreferences (ContextImpl.java:372)
at android.content.ContextWrapper.getSharedPreferences (ContextWrapper.java:167)
at android.content.ContextWrapper.getSharedPreferences (ContextWrapper.java:167)
at de.appplant.cordova.plugin.notification.Manager.getPrefs (Manager.java:399)
at de.appplant.cordova.plugin.notification.Manager.getIds (Manager.java:206)
at de.appplant.cordova.plugin.notification.Manager.getOptions (Manager.java:291)
at de.appplant.cordova.plugin.notification.receiver.AbstractRestoreReceiver.onReceive (AbstractRestoreReceiver.java:64)
at android.app.ActivityThread.handleReceiver (ActivityThread.java:3187)
Source code
This is a simplified version of the code I use to set notifications:
setNotification(every:string, firstAt:Date){
let text = this.notificationStrings.daily;
let n:number = 30; // arbitrary large number
let notifications = [];
for (let i:number=0; i<n; i++){
let theAt: Date = new Date(firstAt);
if (every == 'minute'){
theAt.setMinutes(theAt.getMinutes()+i);
}else if (every == 'hour'){
theAt.setHours(theAt.getHours()+i);
}else if (every == 'day'){
theAt.setDate(theAt.getDate()+i);
}else if (every == 'week'){
theAt.setDate(theAt.getDate()+i*7);
}
notifications.push(
{
id: i,
title: this.notificationStrings.title,
text: text,
icon: "",
sound: true,
priority: 1,
smallIcon: "res://"+this.notificationStrings.icon,
foreground: true,
wakeup: false,
trigger:{
at: theAt
}
}
);
}
cordova.plugins.notification.local.cancelAll(
() => {
cordova.plugins.notification.local.schedule(notifications,
() => {
console.log("notification set ", firstAt, every);
}
);
}
);
}
Issue Analytics
- State:
- Created 6 years ago
- Reactions:6
- Comments:33 (3 by maintainers)
Top Results From Across the Web
View crashes and application not responding (ANR) errors
Using Play Console, you can view data for crashes and application not responding (ANR) errors for your apps. Data comes from Android devices...
Read more >Burst of app crashes immediately after publishing to Google Play
Since soon after publishing a new version I see crashes almost only from this device, I'm guessing it's a Google Play new app...
Read more >A brand new website interface for an even better experience!
Hundreds of crash reports from Google Play Console after deploying 0.9.0-beta3.
Read more >Internal testing | Google Play Console
Quickly distribute your builds to a small set of trusted testers without the need to wait for app reviews. Integrate with build qualification...
Read more >Detect and diagnose crashes - Android Developers
An Android app crashes whenever there's an unexpected exit caused by ... how Google Play collects Android vitals data, see the Play Console...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
To fix this crash.
Open file: …/platforms/android/src/de/appplant/cordova/plugin/notification/receiver/AbstractRestoreReceiver.java
Add import: import android.os.UserManager;
Change strings 60-61
if (action.equals(ACTION_BOOT_COMPLETED) && SDK_INT >= 24) return;
to:
if (SDK_INT >= 24) { UserManager um = (UserManager) context.getSystemService(UserManager.class); if (um == null || um.isUserUnlocked() == false) return; }
Great, notifications are triggered even after device reboot ! (Tested on Android 4.4, 5.1, 6.0, 7.1, 8.1). Thx @Reactor13 😄