katzer / cordova-plugin-local-notifications

Cordova Local-Notification Plugin
Apache License 2.0
2.56k stars 1.75k forks source link

Future schedules don't work in Android 9.0 and 8.1 #1797

Open samuelfaj opened 5 years ago

samuelfaj commented 5 years ago

WARNING: IF YOU IGNORE THIS TEMPLATE, WE'LL IGNORE YOUR ISSUE. YOU MUST FILL THIS IN!

All schedules configured to not initiate immediately aren't working.

Your Environment

Expected Behavior

Working:

cordova.plugins.notification.local.schedule({
    title: 'My first notification',
    text: 'Thats pretty easy...',
    foreground: true
});

cordova.plugins.notification.local.schedule([
    { id: 1, title: 'My first notification' },
    { id: 2, title: 'My first notification' }
]);

cordova.plugins.notification.local.schedule({
    title: 'Design team meeting',
    text: '3:00 - 4:00 PM',
    trigger: { at: new Date() }
});

NOT WORKING:


cordova.plugins.notification.local.schedule({
    title: 'Design team meeting',
    text: '3:00 - 4:00 PM',
    trigger: { at: new Date(new Date().getTime() + 3600) }
});

cordova.plugins.notification.local.schedule({
    title: 'Design team meeting',
    text: '3:00 - 4:00 PM',
    trigger: { at: new Date(new Date().getTime() + 60) }
});

cordova.plugins.notification.local.schedule({
    title: 'Design team meeting',
    trigger: { in: 1, unit: 'hour' }
});

cordova.plugins.notification.local.schedule({
    title: 'Design team meeting',
    trigger: { every: 'day', count: 5 }
});

cordova.plugins.notification.local.schedule({
    title: 'Design team meeting',
    trigger: { every: 'minute', count: 5 }
});

cordova.plugins.notification.local.schedule({
    title: 'Happy Birthday!!!',
    trigger: { every: { month: 10, day: 27, hour: 9, minute: 0 } }
});

Actual Behavior

Nothing

Steps to Reproduce

Just reproduce above code.

Context

What were you trying to do?

Debug logs

samuelfaj commented 5 years ago

Awkward... The demo app works, one plugin may be conflicting.

EDIT: ### Plugin was conflicting with cordova-plugin-insomnia

ValentinKlinghammer commented 5 years ago

@samuelfaj Then close the issue?

thiskbj commented 5 years ago

Scheduling notifications is also not working for me in Android 9.0.

Here's are the cordova plugins I'm using:

"cordova": "^9.0.0",
"cordova-android": "^7.1.4",
"cordova-browser": "^5.0.4",
"cordova-ios": "^4.5.5",
"cordova-plugin-badge": "^0.8.8",
"cordova-plugin-browsersync": "^1.1.0",
"cordova-plugin-device": "^2.0.2",
"cordova-plugin-local-notification": "^0.9.0-beta.2",
"cordova-plugin-whitelist": "^1.3.3",

Here's my code:

window.cordova.plugins.notification.local.schedule({
  title: 'How are you?',
  trigger: { every: { minute: 42 } }
})

Any ideas? @samuelfaj, how did you isolate the problem to cordova-insomnia?

EliezerB123 commented 5 years ago

Save us, @samuelfaj Kenobi, you're our only hope!

samuelfaj commented 5 years ago

Scheduling notifications is also not working for me in Android 9.0.

Here's are the cordova plugins I'm using:

"cordova": "^9.0.0",
"cordova-android": "^7.1.4",
"cordova-browser": "^5.0.4",
"cordova-ios": "^4.5.5",
"cordova-plugin-badge": "^0.8.8",
"cordova-plugin-browsersync": "^1.1.0",
"cordova-plugin-device": "^2.0.2",
"cordova-plugin-local-notification": "^0.9.0-beta.2",
"cordova-plugin-whitelist": "^1.3.3",

Here's my code:

window.cordova.plugins.notification.local.schedule({
  title: 'How are you?',
  trigger: { every: { minute: 42 } }
})

Any ideas? @samuelfaj, how did you isolate the problem to cordova-insomnia?

I've uninstalled cordova-insomnia :(

SnehalJ1509 commented 4 years ago

I am also facing the same issue, after scheduling the local notifications in my app and killing the app, the notifications are not firing in my phone on the time scheduled. I searched for some solution for couple of months but with no luck.

But recently when my colleague was working with the local notifications in another app and tried on his phone, they were working fine. It was very strange to know that the same plugin is working on his device and not on my device, even though the plugin version and the Android version were same on both the devices (Android 9). Being curious, we tested on few other devices and we found that the notifications were firing on the devices having base android/Android One and not on the devices having custom OS viz MIUI, Funtouch OS, Color OS, Oxygen OS.

Following are devices we tested that are having base android/Android One on which notifications were firing properly:- Nokia 6.1 Samsung Galaxy A5 Moto G5S Plus MI A2

Following are devices we tested that are having custom OS and on which notifications did not fire:- Oneplus 7 Pro (Oxygen OS) Vivo V11 Pro (Funtouch OS) Oppo F9 (Color OS) Redmi Note 4 (MIUI)

So I think this might not be the issue with the plugin itself but with the custom android OS.

My ionic info:-

Ionic:

ionic (Ionic CLI) : 4.12.0 (/Users/Hybrid/.nvm/versions/node/v10.15.1/lib/node_modules/ionic) Ionic Framework : @ionic/angular 4.4.0 @angular-devkit/build-angular : 0.13.9 @angular-devkit/schematics : 7.2.4 @angular/cli : 7.2.4 @ionic/angular-toolkit : 1.3.0

Cordova:

cordova (Cordova CLI) : 8.1.2 (cordova-lib@8.1.1) Cordova Platforms : android 7.1.4, ios 5.0.0 Cordova Plugins : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 4.0.1, (and 19 other plugins)

System:

Android SDK Tools : 26.1.1 (/Users/Hybrid/Library/Android/sdk) ios-deploy : 1.9.4 ios-sim : 7.0.0 NodeJS : v10.15.1 (/Users/Hybrid/.nvm/versions/node/v10.15.1/bin/node) npm : 6.4.1 OS : macOS High Sierra Xcode : Xcode 10.1 Build version 10B61

jasonandress commented 4 years ago

Can you tell us what the conflict was? I don't use the plugin insomnia.

sahyun1 commented 4 years ago

I've tried with setting ids and it seems to help