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

Local-notification plugin crash on notification event on android 7 #1261

Closed
tevels opened this issue Apr 2, 2017 · 21 comments
Closed

Local-notification plugin crash on notification event on android 7 #1261

tevels opened this issue Apr 2, 2017 · 21 comments

Comments

@tevels
Copy link

tevels commented Apr 2, 2017

Local-notification plugin crash on notification event on android 7
It worked OK on android 6, just after upgrading to android 7 it started to crash

Only when tapping the notification the application crash (Both if app in foreground or background)

Enviroment:
Plugin version: 0.8.4
Platform: Android
OS version: 7.0
Device manufacturer / model: Samsung 6 edge+
Cordova version (cordova -v): 6.4.0
Cordova platform version (cordova platform ls): android 6.0.0 platform

@rwillett
Copy link
Collaborator

rwillett commented Apr 2, 2017

Fill out #1188 as not enough information here

@chevarria
Copy link

same here

@rwillett
Copy link
Collaborator

rwillett commented Apr 5, 2017

What crashed?

What code?

The template asks for more information than what you have shown.

I know that the code doesn't crash when we use iit in Genymotiio.

@chevarria
Copy link

The app crashed on Android 7 only you using a sound file mp3/wav. Android 6 it doesn't ocurrs.

Follow below the schedule that works on Android 6 and crash on Android 7.

$cordovaLocalNotification.schedule({
id: "1234",
at: new Date(new Date().getTime() + (2 * 1000)),
text: "Message",
title: "Title",
sound: "file://sounds/alarm.wav"
})

Thanks.

@rwillett
Copy link
Collaborator

rwillett commented Apr 5, 2017

So if you remove sound: it works OK?

@chevarria
Copy link

Yes, it works perfectly.

@mehrshadpezeshk
Copy link

Hi guys,

we have the exact same issue, when you will resolve it ?

Best

@touficbatache
Copy link

Same here

@vegham
Copy link

vegham commented Apr 28, 2017

Below are the two error messages created upon application crash (due to unhandled exception)

04-28 22:10:12.580 10105 10105 E AndroidRuntime: java.lang.RuntimeException: Unable to start receiver de.appplant.cordova.plugin.localnotification.TriggerReceiver: android.os.FileUriExposedException: file:///storage/emulated/0/Android/data/this.app/cache/localnotification/sound.m4a exposed beyond app through Notification.sound
04-28 22:10:12.580 10105 10105 E AndroidRuntime: Caused by: android.os.FileUriExposedException: file:///storage/emulated/0/Android/data/this.app/cache/localnotification/sound.m4a exposed beyond app through Notification.sound

Android SDK >= 24 have removed the file:// option as written here: https://developer.android.com/reference/android/os/FileUriExposedException.html

This plugin must most likely adopt the content:// protocol for Android. The following site explain how to do it for Android in general: https://inthecheesefactory.com/blog/how-to-share-access-to-file-with-fileprovider-on-android-nougat/en

Until then a simple workaround is to set android:targetSdkVersion="23" in your AndroidManifest.xml

@souly1
Copy link

souly1 commented Apr 30, 2017

+1

@tevels
Copy link
Author

tevels commented May 7, 2017

None of the above offered solution solved the problem.
The crash occures only when tapping the notification !!!!
If someone could check the reason for the crash in java code just after tapping the notification

@cquezpro
Copy link

yes, I got same crash when tap the notification.
But my Android version is 6.0.1 and model is Galaxy Tab S.
It works fine on my other device.(Galaxy S3)
Please help about that.
Thanks

@sabirali007
Copy link

+1

@abidvf
Copy link

abidvf commented Jun 7, 2017

+1
Did anyone find any solution for it?

@sabirali007
Copy link

Thanks #vegham,
It works perfectly on android 7 after set android:targetSdkVersion="23"

@chevarria
Copy link

Yeah.. it works perfectly after set android:targetSdkVersion="23".
Thanks.

@tevels
Copy link
Author

tevels commented Jul 11, 2017

setting android:targetSdkVersion="23" DIDN'T solved the crash that happens after clicking the notification.

@hadidiwao
Copy link

android:targetSdkVersion="23" worked for me, thanks !

@jorgecachoh
Copy link

Same error here when click on a local notification (Android 7.1.2):

java.lang.RuntimeException: Unable to resume activity {com.jorgecacho.familiaalbertiana/de.appplant.cordova.plugin.localnotification.Clic kActivity}: java.lang.IllegalStateException: Activity {com.jorgecacho.familiaalbertiana/de.appplant.cordova.plugin.localnotification.ClickActivity} did not call finish() prior to onResum e() completing

I'vre tried to set minSdkVersion = 23, but it doesn0't fix the error, and I need to app to run on older devices ...

Is there any fix fot this?

@katzer
Copy link
Owner

katzer commented Oct 31, 2017

That has been fixed 🥇

@katzer katzer closed this as completed Oct 31, 2017
@Ivan-Perez
Copy link

Ivan-Perez commented Oct 16, 2018

Latest available version of this plugin (0.8.5) still exhibits the reported behaviour on this issue. I've seen there are lots of commits since that version, as the latest published version is from more than one year ago. Have you fixed it in one of those commits? In that case, can you please make a new release?

Since June 1, 2018 Google rejects apps compiled against older SDKs (minimum now is 26, so the workaround to use SDK 23 cannot be used for a production app).

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests