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

Android 6: Local notifications not delivered after smartphone reboot #1247

Closed
Paddy78de opened this issue Mar 21, 2017 · 8 comments
Closed
Labels

Comments

@Paddy78de
Copy link

Hi,

some users of our app with Android 6.0 say that local notifications are not delivered after they have restarted their smartphone. They have to open the app first and then the notifications are delivered (The app sets the notifications after starting). We couldn't reproduce that bug with our Android 6 test devices/simulators.

Could anyone give us a hint?

@rwillett
Copy link
Collaborator

Fill out #1188 as that gives us some idea what you are doing. Not enough information here.

@Paddy78de
Copy link
Author

**Plugin version:**  0.8.4
**Platform:** Android
**OS version:** 6.0
**Device manufacturer / model:** Samsung Galaxy S7
**Cordova version (cordova -v):** 6.5.0
**Cordova platform version (cordova platform ls):** android 6.0.0,  ios 4.2.1

Other plugins: cordova-plugin-app-event, cordova-plugin-badge, cordova-plugin-device, cordova-plugin-dialogs, cordova-plugin-globalization, cordova-plugin-statusbar, cordova-plugin-whitelist, cordova-sqlite-ext

Expected Behavior

Tell us what should happen

After rebooting the phone, the scheduled notifications of the app should be delivered at the chosen time without having to start the app first.

Actual Behavior

Tell us what happens instead

The app has to be started once after rebooting the phone.

Steps to Reproduce

Reproduce this issue; include code to reproduce, if relevant

Actually, we can't reproduce the issue with our own devices and simulators. We have been informed by a few users that they have that issue. So we are not sure if the scheduled notifications are gone after rebooting the phone or if they just don't work because the app is not running.

The mechanism of the scheduled notifications within the app is that way:

When the app is started or when the user changes a setting that targets the notifications, the notifcations are emptied:

cordova.plugins.notification.local.cancelAll(function() {
.
.
.
});

Within the callback the notifications are set:

cordova.plugins.notification.local.schedule({
id: notification_id,
at: td,
title: app_translations["appname"],
text: ttext,
badge: 1
});

The variables are set of course.

@rwillett
Copy link
Collaborator

Not seen this happen but I would check:

  1. You have a unique ID set,
  2. Your td variable is correctly set. People get this constantly wrong. I never believe it unless I check it by printing it out. Saying The variables are set of course. means nothing.
  3. Try removing the badge variable. We've had some issues with this working correctly with constantly changing it along with push notifications and so we gave up.
  4. Enclose the JSON in an array even if there is only one element.
  5. You are using an older version of the plugin. Try the later one.
  6. Is ttext actually the variable name?

@Paddy78de
Copy link
Author

Thanks for Your answer.
I will try the hint with the badge removal.

As the notifications work perfectly when the device hasn't been rebooted I think we can exclude a variable problem here.

One final question: You say there is a newer version of the plugin. I use 0.8.4 and this is the latest version I can see.

@rwillett
Copy link
Collaborator

I suspect that your users are using Android phones and that the manufacturer has changed the underlying OS for their own needs. The fact that it works for you and you can't reproduce it tends to back this up.

If it is this problem, not a lot can be done as this is not a bug here, but rather the manufacturers have decided to screw things up.

@PawelGIX
Copy link

I have a similar problem. Notifications appear if the time elapsed since their registration is short. If the time is longer than a few hours, the notification will not appear.

@rwillett
Copy link
Collaborator

@PawelGIX

What do you mean by 'registation'? Do you mean when notifications are scheduled? You need to provide more information. OS versions, logs, code. The template in #1188 is useful as it forces people to think through their comments rather than just saying "me too".

We schedule local notifications for the next day on IOS and Android without any issues. We don't do more than approx 36 hours though.

@rwillett
Copy link
Collaborator

Closed as no update from original poster.

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

No branches or pull requests

3 participants