cordova-plugin-local-notifications
cordova-plugin-local-notifications copied to clipboard
App crashes with URL icon or attachment
Provide a general summary of the issue.
Your Environment
- Plugin version: 0.9.0-beta.2
- Platform: Android and iOs
- OS version: Android 8.1.0, iOs 13.6
- Device manufacturer / model: Android tablet Lenovo TB-8504F, iphone XR
- Cordova version (
cordova -v
): 10.0.0 - Cordova platform version (
cordova platform ls
): Android 9.0.0, iOs 6.1.0 - Plugin config
Expected Behavior
Show notification with icon and attachment from URL.
Actual Behavior
I'm using visual studio code to develop the app.
On Android: Using URL on icon and attachment crashes app. If I uninstall and reinstall the plugin the notification works and shows the icon and attachment from URL then if I debug the app one second time the app crashes.
On iOs: Always showing "file not found" when I know the file exists on the server.
Steps to Reproduce
Code used: cordova.plugins.notification.local.schedule({ title: 'Olá!', text: 'Bem vindo(a) à sua aplicação de acompanhamento nutricional.', vibrate: true, smallIcon: 'res://notification_icon', icon:'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTzfXKe6Yfjr6rCtR6cMPJB8CqMAYWECDtDqH-eMnerHHuXv9egrw', attachments: ['https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTzfXKe6Yfjr6rCtR6cMPJB8CqMAYWECDtDqH-eMnerHHuXv9egrw'], foreground: true });
- Uninstall plugin
- Reinstall plugin
- Debug the app - all goes well
- Stop debugging
- Start debugging
- App crashes on android
- on iOs always saying "File not found: https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTzfXKe6Yfjr6rCtR6cMPJB8CqMAYWECDtDqH-eMnerHHuXv9egrw"
Context
What were you trying to do?
Debug logs
Android logs: 08-20 00:48:14.045 12502 12599 E AndroidRuntime: FATAL EXCEPTION: pool-1-thread-3 08-20 00:48:14.045 12502 12599 E AndroidRuntime: Process: pt.gooddiet.app, PID: 12502 08-20 00:48:14.045 12502 12599 E AndroidRuntime: java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.res.XmlResourceParser android.content.pm.ProviderInfo.loadXmlMetaData(android.content.pm.PackageManager, java.lang.String)' on a null object reference 08-20 00:48:14.045 12502 12599 E AndroidRuntime: at android.support.v4.content.FileProvider.parsePathStrategy(FileProvider.java:584) 08-20 00:48:14.045 12502 12599 E AndroidRuntime: at android.support.v4.content.FileProvider.getPathStrategy(FileProvider.java:558) 08-20 00:48:14.045 12502 12599 E AndroidRuntime: at android.support.v4.content.FileProvider.getUriForFile(FileProvider.java:400) 08-20 00:48:14.045 12502 12599 E AndroidRuntime: at de.appplant.cordova.plugin.notification.util.AssetUtil.getUriFromFile(AssetUtil.java:365) 08-20 00:48:14.045 12502 12599 E AndroidRuntime: at de.appplant.cordova.plugin.notification.util.AssetUtil.getUriFromRemote(AssetUtil.java:214) 08-20 00:48:14.045 12502 12599 E AndroidRuntime: at de.appplant.cordova.plugin.notification.util.AssetUtil.parse(AssetUtil.java:93) 08-20 00:48:14.045 12502 12599 E AndroidRuntime: at de.appplant.cordova.plugin.notification.Options.getLargeIcon(Options.java:355) 08-20 00:48:14.045 12502 12599 E AndroidRuntime: at de.appplant.cordova.plugin.notification.Builder.build(Builder.java:159) 08-20 00:48:14.045 12502 12599 E AndroidRuntime: at de.appplant.cordova.plugin.localnotification.TriggerReceiver.buildNotification(TriggerReceiver.java:120) 08-20 00:48:14.045 12502 12599 E AndroidRuntime: at de.appplant.cordova.plugin.notification.receiver.AbstractTriggerReceiver.onReceive(AbstractTriggerReceiver.java:60) 08-20 00:48:14.045 12502 12599 E AndroidRuntime: at de.appplant.cordova.plugin.notification.Notification.trigger(Notification.java:254) 08-20 00:48:14.045 12502 12599 E AndroidRuntime: at de.appplant.cordova.plugin.notification.Notification.schedule(Notification.java:206) 08-20 00:48:14.045 12502 12599 E AndroidRuntime: at de.appplant.cordova.plugin.notification.Manager.schedule(Manager.java:100) 08-20 00:48:14.045 12502 12599 E AndroidRuntime: at de.appplant.cordova.plugin.localnotification.LocalNotification.schedule(LocalNotification.java:273) 08-20 00:48:14.045 12502 12599 E AndroidRuntime: at de.appplant.cordova.plugin.localnotification.LocalNotification.access$400(LocalNotification.java:60) 08-20 00:48:14.045 12502 12599 E AndroidRuntime: at de.appplant.cordova.plugin.localnotification.LocalNotification$1.run(LocalNotification.java:145) 08-20 00:48:14.045 12502 12599 E AndroidRuntime: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162) 08-20 00:48:14.045 12502 12599 E AndroidRuntime: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636) 08-20 00:48:14.045 12502 12599 E AndroidRuntime: at java.lang.Thread.run(Thread.java:764) 08-20 00:48:14.064 969 3515 W ActivityManager: Force finishing activity pt.gooddiet.app/.MainActivity 08-20 00:48:14.066 969 3515 D ActivityTrigger: ActivityTrigger activityPauseTrigger 08-20 00:48:14.067 12502 12502 D CordovaActivity: Paused the activity. 08-20 00:48:14.079 969 1976 D ActivityTrigger: activityResumeTrigger: The activity in ApplicationInfo{8136da0 com.lenovo.launcher} is now in focus and seems to be in full-screen mode 08-20 00:48:14.079 969 1976 E ActivityTrigger: activityResumeTrigger: not whiteListedcom.lenovo.launcher/com.android.launcher3.Launcher/3000010 08-20 00:48:14.086 1995 2223 W Adreno-ES20: <core_glFinish:34>: glFinish skipped: 0 08-20 00:48:14.087 1995 2223 W Adreno-ES20: <core_glFinish:34>: glFinish skipped: 0 08-20 00:48:14.097 969 984 W AppErrorDialog: blockSize=4096,,availableBlocks=842301 08-20 00:48:14.097 969 984 W AppErrorDialog: memory=3450064896 08-20 00:48:14.097 969 984 I ActivityManager: Showing crash dialog for package pt.gooddiet.app u0 08-20 00:48:14.100 1995 1995 V Launcher: Launcher.onResume() 08-20 00:48:14.100 1995 2063 D NotificationListener: handleMessage->3 08-20 00:48:14.102 1995 1995 D Launcher: Deferring update until onResume 08-20 00:48:14.104 969 983 W BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.DROPBOX_ENTRY_ADDED flg=0x10 (has extras) } to com.google.android.gms/.stats.service.DropBoxEntryAddedReceiver 08-20 00:48:14.106 1995 1995 D Launcher: Time spent processing callbacks in onResume: 1 08-20 00:48:14.106 1995 1995 D Launcher: Time spent in onResume: 6 08-20 00:48:14.106 969 1529 D CompatibilityInfo: mCompatibilityFlags - 4 08-20 00:48:14.107 969 1529 D CompatibilityInfo: applicationDensity - 213 08-20 00:48:14.107 969 1529 D CompatibilityInfo: applicationScale - 1.0 08-20 00:48:14.107 1995 1995 D AllAppsContainerView: NavBarBg:16,200 08-20 00:48:14.107 1995 2063 D NotificationListener: filterNotifications->6 08-20 00:48:14.108 969 983 W BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.DROPBOX_ENTRY_ADDED flg=0x10 (has extras) } to com.google.android.gms/.chimera.GmsIntentOperationService$PersistentTrustedReceiver 08-20 00:48:14.118 1995 2223 W Adreno-EGL: <qeglDrvAPI_eglGetConfigAttrib:612>: EGL_BAD_ATTRIBUTE 08-20 00:48:14.122 1995 2223 D vndksupport: Loading /vendor/lib64/hw/gralloc.msm8937.so from current namespace instead of sphal namespace. 08-20 00:48:14.125 1349 1349 I GoogleInputMethodService: GoogleInputMethodService.onFinishInput():3162 08-20 00:48:14.126 1349 1349 I GoogleInputMethodService: GoogleInputMethodService.onStartInput():1831 08-20 00:48:14.130 969 1529 D CompatibilityInfo: mCompatibilityFlags - 4 08-20 00:48:14.130 969 1529 D CompatibilityInfo: applicationDensity - 213 08-20 00:48:14.130 969 1529 D CompatibilityInfo: applicationScale - 1.0 08-20 00:48:14.133 969 1529 D CompatibilityInfo: mCompatibilityFlags - 4 08-20 00:48:14.133 969 1529 D CompatibilityInfo: applicationDensity - 213 08-20 00:48:14.133 969 1529 D CompatibilityInfo: applicationScale - 1.0 08-20 00:48:14.150 969 4765 I Adreno-EGL: <qeglDrvAPI_eglInitialize:379>: QUALCOMM Build: 08/23/18, 26560a1, I77d3059488 08-20 00:48:14.150 969 4765 I zygote64: android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasWideColorDisplay retrieved: 0 08-20 00:48:14.151 969 4765 I OpenGLRenderer: Initialized EGL, version 1.4 08-20 00:48:14.151 969 4765 D OpenGLRenderer: Swap behavior 2 08-20 00:48:14.156 969 4765 W Adreno-EGL: <qeglDrvAPI_eglGetConfigAttrib:612>: EGL_BAD_ATTRIBUTE 08-20 00:48:14.158 969 4765 W Adreno-EGL: <qeglDrvAPI_eglGetConfigAttrib:612>: EGL_BAD_ATTRIBUTE 08-20 00:48:14.160 969 4765 D vndksupport: Loading /vendor/lib64/hw/gralloc.msm8937.so from current namespace instead of sphal namespace. 08-20 00:48:14.170 12502 12566 W Adreno-ES20: <core_glFinish:34>: glFinish skipped: 0 08-20 00:48:14.479 12502 12566 I chatty : uid=10208(pt.gooddiet.app) RenderThread identical 2 lines 08-20 00:48:14.481 12502 12566 W Adreno-ES20: <core_glFinish:34>: glFinish skipped: 0 08-20 00:48:14.481 12502 12502 D CordovaActivity: Stopped the activity. 08-20 00:48:14.483 12502 12502 D CordovaActivity: CordovaActivity.onDestroy()
iOs logs: 2020-08-20 00:44:55.324270+0100 GoodDiet[39263:3895591] File not found: https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTzfXKe6Yfjr6rCtR6cMPJB8CqMAYWECDtDqH-eMnerHHuXv9egrw
hii @jabelcs are you able to solve it?
Hi @Risi1997
I can't solve it but I found a workaround. Every time I need to create a release I uninstall and reinstall the plugin then, immediately after the reinstall I run de release creation command. This way the plugin works fine for me but when I debug the app the plugin causes the app to crash again. I just need to remember to follow these steps every time I want to launch a new version.
hi all, perhaps you can try this fork, it is more recent and still maintained: https://github.com/timkellypa/cordova-plugin-local-notifications
hope it helps. thanks.
Hi @rahmadid .
I will try that and post the results.
Thanks.
Cannot use this fork, it gives me a lot of errors.
100 errors only showing the first 100 errors, of 102 total; use -Xmaxerrs if you would like to see more
Task :app:mergeDebugNativeLibs Task :app:desugarDebugFileDependencies
FAILURE: Build failed with an exception.
- What went wrong: Execution failed for task ':app:compileDebugJavaWithJavac'.
Compilation failed; see the compiler error output for details.
-
Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
-
Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0. Use '--warning-mode all' to show the individual deprecation warnings. See https://docs.gradle.org/6.5/userguide/command_line_interface.html#sec:command_line_warnings 34 actionable tasks: 34 executed
BUILD FAILED in 11s Command failed with exit code 1: /Volumes/HDData/PROJECTOS/gooddiet.pt/APP/GoodDiet/platforms/android/gradlew cdvBuildDebug -b /Volumes/HDData/PROJECTOS/gooddiet.pt/APP/GoodDiet/platforms/android/build.gradle Error: Command failed with exit code 1: /Volumes/HDData/PROJECTOS/gooddiet.pt/APP/GoodDiet/platforms/android/gradlew cdvBuildDebug -b /Volumes/HDData/PROJECTOS/gooddiet.pt/APP/GoodDiet/platforms/android/build.gradle at makeError (/Volumes/HDData/PROJECTOS/gooddiet.pt/APP/GoodDiet/node_modules/execa/lib/error.js:59:11) at handlePromise (/Volumes/HDData/PROJECTOS/gooddiet.pt/APP/GoodDiet/node_modules/execa/index.js:114:26) at processTicksAndRejections (internal/process/task_queues.js:97:5) at async Promise.all (index 0) 'cordova run android --device --verbose --no-update-notifier' failed with exit code 1
@jabelcs I myself never had that error. Perhaps you can ask (open an issue) in that repo?
@jabelcs that fork uses androidx, perhaps the error related to it?