Cordova-plugin-local-notifications: Future schedules don't work in Android 9.0 and 8.1

Created on 19 May 2019  路  8Comments  路  Source: katzer/cordova-plugin-local-notifications

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

  • Plugin version: tried from master to 0.9.0-beta.3
  • Platform: Android
  • OS version: 0.8.1, 9.0
  • Device manufacturer / model: Nexus 4 (0.8.1) - Samsung S9 (0.9)
  • Cordova version (cordova -v): 8.1.2 ([email protected])
  • Cordova platform version (cordova platform ls): android 7.1.4
  • Plugin config

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

Most helpful comment

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?

All 8 comments

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

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

@samuelfaj Then close the issue?

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?

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

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 :(

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 ([email protected])
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

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

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

skks1212 picture skks1212  路  4Comments

neshke89 picture neshke89  路  4Comments

tverilytt picture tverilytt  路  4Comments

AbayIbrayev picture AbayIbrayev  路  4Comments

mino922 picture mino922  路  3Comments