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

[Question] Notifications not working on Android 14 #6

Open
PreciousBiscuit opened this issue Dec 4, 2023 · 10 comments
Open

[Question] Notifications not working on Android 14 #6

PreciousBiscuit opened this issue Dec 4, 2023 · 10 comments

Comments

@PreciousBiscuit
Copy link

Does anyone know why notifications are not working on Android 14?
What is the difference between Android 13 and 14, and what needs to be changed in the plugin code to make it work?
There is no error, debug info, nothing in the logcat.

Thank you for any helpful pointers.

Your Environment

  • Plugin version: 0.10.0
  • Platform: Android
  • OS version: 14
@PreciousBiscuit
Copy link
Author

So far I have found out that the plugin uses setExact() methods which require USE_EXACT_ALARM permission on Android 14. However using this permissions may cause the Play Store to decline the app.

@xallysie
Copy link

xallysie commented Dec 8, 2023

I'm experiencing the same issue. To bypass the Play Store policy, the plugin may need to be updated to schedule inexact alarms instead, so the notification fires within an hour of the set time.

@PreciousBiscuit
Copy link
Author

Unfortunately that is not acceptable solution for our app. So for now I have made fork that uses USE_EXACT_ALARM permission and I will see if Google starts crying or not.
Fork link: https://github.com/PreciousBiscuit/cordova-plugin-local-notifications

@TeoMastro
Copy link

Hello, since I have the same issues with you @PreciousBiscuit and I actually tried the exactly same thing you did, I still have the google play console error. Our app is in internal testing and I have also made an issue (katzer#2016) to the fork with the most stars so everyone can see. There I describe my findings and what I have found so far as a possible solution. Did your fork fix the problem? Thanks in advance.

@TeoMastro
Copy link

TeoMastro commented Feb 9, 2024

@xallysie I saw your plugin (https://github.com/xallysie/cordova-plugin-android14-schedule-exact-alarm/blob/main/src/android/com/android/plugins/ScheduleExactAlarm.java). This seems to be an acceptable approach to the exact alarms problem for Android 14 (I mean the logic according to the android documentation). Will you try to implement an approach like that to an existing fork?

@PreciousBiscuit
Copy link
Author

Hi @TeoMastro , my fork only changed permissions and nothing else. I'm not aware of any crashes nor any console error in the Google store. If there was any issue (a crash, an error, not working notifications) I would have been notified.

@TeoMastro
Copy link

TeoMastro commented Feb 9, 2024

Hello @PreciousBiscuit. In an older app that uses the plugin the error does not exist. But now that we uploaded a fresh app we saw this error in the console using the exact same plugin. Note that both apps target the same SDK (33)

@PreciousBiscuit
Copy link
Author

PreciousBiscuit commented Feb 9, 2024

Unfortunately I have no way to verify that myself. We don't have any other app that would use this plugin (yet). However our app targets SDK 33 as well.
Just asking, because I'm not sure which fork you have tried or what changes you have made, but are you sure you didn't change anything that could cause crashes?
Or other thing that comes to mind is that there is a bug on Google side. :)

@TeoMastro
Copy link

Yes I am 100% positive. I found something that might fix the problem but I am still testing it. If I have any updates I will let you know all.

@xallysie
Copy link

xallysie commented Feb 14, 2024

@xallysie I saw your plugin (https://github.com/xallysie/cordova-plugin-android14-schedule-exact-alarm/blob/main/src/android/com/android/plugins/ScheduleExactAlarm.java). This seems to be an acceptable approach to the exact alarms problem for Android 14 (I mean the logic according to the android documentation). Will you try to implement an approach like that to an existing fork?

That plugin is still in development and I haven't been able to get it to work yet. If someone could take a look at the code and see what needs to be done, that'd be appreciated!

Edit: nvm, I realized that SCHEDULE_EXACT_ALARM follows a different logic than other types of permissions (which @TeoMastro alluded to!). Simplified the plugin so that it opens the Alarms & Reminders setting and prompts users to toggle enable the permission themselves. They will then use the back arrow at the top of the page to return to the app.

It seems this is how google intended this permission to be requested, so my plugin can be used safely with this fork. yay!

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

3 participants