Cordova-plugin-local-notifications: No notification or error at all

Created on 10 Nov 2017  Â·  33Comments  Â·  Source: katzer/cordova-plugin-local-notifications

Unable to get the plugin working. Never have been this difficult to get it on track. Am i missing something.

Your Environment

  • Plugin version:
    v0.8.5
  • Platform:
    Phonegap Build APK
    Phonegap Developer App(Both iOS & Android)
  • OS version:
    Android & iOS

  • Device manufacturer / model:
    iPhone 6s & Multiple Androids

  • Cordova version (cordova -v):
    7.1.0
  • Cordova platform version (cordova platform ls):
    android 6.3.0
    ios 4.1.1
    browser ~5.0.0
  • Plugin config
    tried both
    ->cordova plugin add cordova-plugin-local-notifications
    ->phonegap plugin add cordova-plugin-local-notifications

Expected Behavior

Notification should popup either in foreground or background.

Actual Behavior

Nothing works at all.
No console .
No error.

Steps to Reproduce

Tried more than 7/8 times but nothing works

1) Tried multiple times adding plugin.
2) Also tried already working(for others) mutiple github repositories.
3) Tried kitchen sink app
For eg:
https://github.com/joe-mutti/How-to-Use-Local-Push-Notification-In-Phonegap/

Context

_What were you trying to do?_
Trying to get Local notification working. Both immediately and scheduling but nothing works

All 33 comments

v0.8.x doesn't (fully) support newest Android and iOS versions. I rather suggest you to upgrade to 0.9-beta.

I did upgrade but still nothing works at all.

How is this possible? The installation of version 0.9-beta through npm? Same problem for android 8

No! i added it manually after getting suggestion from @katzer

Also it might be needed to mention that i am neither getting any prompt to confirm access for notification on iOS.
Also i can't see any notification option in Settings>Phonegap

@katzer Any Update? It's urgent

@katzer my issue at thread #1421 still exists. It should not have been closed over the weekend. As I mentioned in my thread, complete newbie and just tried seeing the app in action. Just got the recommened example-x installed to see that it too does not work on the device. Hopefully thread #1421 will be reopened.

The reason can only be that something goes wrong with the installation or your device version is not supported.

Supported versions: iOS10, iOS11, Android 6-7, Android 8 (limited as of now), Windows 10

@katzer I am testing on iOS 11 and Android 8 and using Phonegapp Developer App.
Still nothing works!!

cordova plugin add cordova-plugin-local-notifications

cordova plugin add https://github.com/katzer/cordova-plugin-local-notifications

Please don't install via plugin id - the README is ahead of time.

@katzer Can you please provide JS code that should show a notification like complete code?
Also do we need to include some JS file too?

On 14-Nov-2017, at 4:22 PM, Sebastián Katzer <[email protected]notifications@github.com> wrote:

cordova plugin add cordova-plugin-local-notifications

cordova plugin add https://github.com/katzer/cordova-plugin-local-notifications

Please don't install via plugin id - the README is ahead of time.

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHubhttps://github.com/katzer/cordova-plugin-local-notifications/issues/1422#issuecomment-344220772, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ALsxWVkTa_cED1JB0RZPrrtFE4c4Z3qtks5s2XDZgaJpZM4QZI8B.

@katzer I am getting this response:
C:Usersjoejoe>cordova plugin add https://github.com/katzer/cordova-plugin-local-notifications
Error: Failed to fetch plugin https://github.com/katzer/cordova-plugin-local-notifications via registry.
Probably this is either a connection problem, or plugin spec is incorrect.
Check your connection and plugin name/version/URL.
Error: cmd: Command failed with exit code 1 Error output:
npm WARN addRemoteGit Error: not found: git
npm WARN addRemoteGit at getNotFoundError (C:Program Filesnodejsnode_modulesnpmnode_moduleswhichwhich.js:14:12)
npm WARN addRemoteGit at F (C:Program Filesnodejsnode_modulesnpmnode_moduleswhichwhich.js:69:19)
npm WARN addRemoteGit at E (C:Program Filesnodejsnode_modulesnpmnode_moduleswhichwhich.js:81:29)
npm WARN addRemoteGit at C:Program Filesnodejsnode_modulesnpmnode_moduleswhichwhich.js:90:16
npm WARN addRemoteGit at C:Program Filesnodejsnode_modulesnpmnode_moduleswhichnode_modulesisexeindex.js:44:5
npm WARN addRemoteGit at C:Program Filesnodejsnode_modulesnpmnode_moduleswhichnode_modulesisexewindows.js:29:5
npm WARN addRemoteGit at C:Program Filesnodejsnode_modulesnpmnode_modulesgraceful-fspolyfills.js:264:29
npm WARN addRemoteGit at FSReqWrap.oncomplete (fs.js:123:15)
npm WARN addRemoteGit git+https://github.com/katzer/cordova-plugin-local-notifications.git resetting remote C:UsersjoeAppDataRoamingnpm-cache_git-remotesgit-https-github-com-katzer-cordova-plugin-local-notifications-git-2b6f5216 because of error: { Error: not found: git
npm WARN addRemoteGit at getNotFoundError (C:Program Filesnodejsnode_modulesnpmnode_moduleswhichwhich.js:14:12)
npm WARN addRemoteGit at F (C:Program Filesnodejsnode_modulesnpmnode_moduleswhichwhich.js:69:19)
npm WARN addRemoteGit at E (C:Program Filesnodejsnode_modulesnpmnode_moduleswhichwhich.js:81:29)
npm WARN addRemoteGit at C:Program Filesnodejsnode_modulesnpmnode_moduleswhichwhich.js:90:16
npm WARN addRemoteGit at C:Program Filesnodejsnode_modulesnpmnode_moduleswhichnode_modulesisexeindex.js:44:5
npm WARN addRemoteGit at C:Program Filesnodejsnode_modulesnpmnode_moduleswhichnode_modulesisexewindows.js:29:5
npm WARN addRemoteGit at C:Program Filesnodejsnode_modulesnpmnode_modulesgraceful-fspolyfills.js:264:29
npm WARN addRemoteGit at FSReqWrap.oncomplete (fs.js:123:15) code: 'ENOGIT' }
npm ERR! git clone --template=C:UsersjoeAppDataRoamingnpm-cache_git-remotes_templates --mirror https://github.com/katzer/cordova-plugin-local-notifications.git C:UsersjoeAppDataRoamingnpm-cache_git-remotesgit-https-github-com-katzer-cordova-plugin-local-notifications-git-2b6f5216: undefined
npm ERR! git clone --template=C:UsersjoeAppDataRoamingnpm-cache_git-remotes_templates --mirror https://github.com/katzer/cordova-plugin-local-notifications.git C:UsersjoeAppDataRoamingnpm-cache_git-remotesgit-https-github-com-katzer-cordova-plugin-local-notifications-git-2b6f5216: undefined
npm ERR! Windows_NT 10.0.15063
npm ERR! argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "install" "https://github.com/katzer/cordova-plugin-local-notifications" "--production" "--save"
npm ERR! node v6.11.4
npm ERR! npm v3.10.10
npm ERR! code ENOGIT

npm ERR! not found: git
npm ERR!
npm ERR! Failed using git.
npm ERR! This is most likely not a problem with npm itself.
npm ERR! Please check if you have git installed and in your PATH.

npm ERR! Please include the following file with any support request:

@joe-mutti

As you have exec cordova plugin add cordova-plugin-local-notifications you have installed something but not this plugin. You need to cleanup that first and make sure that v0.9-beta is installed.

You can try with --nofetch or install from local source as described in the README.

cordova plugin add https://github.com/katzer/cordova-plugin-local-notifications.git --nofetch

v0.9-beta is not yet available on npm.

I want to use cordova-plugin-local-notification, however this name is in use and the person has not replied to my email so far. https://www.npmjs.com/package/cordova-plugin-local-notification

All these samples work. I can execute them without problems.
https://github.com/katzer/cordova-plugin-local-notifications#basics

@katzer Please give me two mintues, I am trying just now. If i could solve it by today it would be a great help for me.
Please!

@katzer I just tried each step you said it didn't work.
OUTPUT:
cordova plugin list
cordova-plugin-badge 0.8.5 "Badge"
cordova-plugin-device 1.1.7 "Device"
cordova-plugin-local-notification 0.9.0-beta.1 "LocalNotification"
cordova-plugin-whitelist 1.3.3 "Whitelist"

Please provide your logs

I have installed successfully but it doesn't seem to work for me. I believe there is a problem on the relative paths.
Logs from Android build from Ionic 3 cordova:

Line 53489 : Native: tried calling LocalNotifications.getAllIds, but the LocalNotifications plugin is not installed.
Line 53495 : Install the LocalNotifications plugin: 'ionic cordova plugin add de.appplant.cordova.plugin.local-notification'

dependencies: {
"angular/common": "4.1.3",
"angular/compiler": "4.1.3",
"angular/compiler-cli": "4.1.3",
"angular/core": "4.1.3",
"angular/forms": "4.1.3",
"angular/http": "4.1.3",
"angular/platform-browser": "4.1.3",
"angular/platform-browser-dynamic": "4.1.3",
"ionic-native/core": "^4.3.2",
"ionic-native/local-notifications": "^4.3.2",
"ionic-native/splash-screen": "^3.12.1",
"ionic-native/status-bar": "3.12.1",
"ionic/storage": "2.0.1",
"chart.js": "^2.7.0",
"cordova-android": "~6.3.0",
"cordova-plugin-badge": "^0.8.5",
"cordova-plugin-console": "^1.0.5",
"cordova-plugin-device": "^1.1.4",
"cordova-plugin-local-notification": "git+https://github.com/katzer/cordova-plugin-local-notifications.git",
"cordova-plugin-splashscreen": "^4.0.3",
"cordova-plugin-statusbar": "^2.2.2",
"cordova-plugin-whitelist": "^1.3.1",
"ionic-angular": "3.6.0",
"ionic-plugin-keyboard": "^2.2.1",
"ionicons": "3.0.0",
"localforage": "^1.5.0",
"rxjs": "5.4.0",
"sw-toolbox": "3.6.0",
"zone.js": "0.8.12"
}

plugins:
"plugins": {
"cordova-plugin-splashscreen": {},
"cordova-plugin-console": {},
"cordova-plugin-device": {},
"cordova-plugin-statusbar": {},
"cordova-plugin-whitelist": {},
"ionic-plugin-keyboard": {},
"cordova-plugin-local-notification": {}
}

The version of the plugin seems to be right 0.9.0-beta.1. I assume that the problem here isn't your fault. Probably the 'ionic-native/local-notifications' is targeting on the old name of the plugin "de.appplant.cordova.plugin.local-notification".

In my case:

Notifications on ios 11.1 not work on foreground(not error). On Android Android 7.0 works fine

I have the 0.8.5 on a ionic project.

How can I install the 0.9.0-beta.1 with npm?

Thanks

@Temeteron

Line 53495 : Install the LocalNotifications plugin: 'ionic cordova plugin add de.appplant.cordova.plugin.local-notification'

Thats not v0.9-beta because it still tries to install with the old plugin id. Try with --nofetch

cordova plugin add path-or-github --nofetch

@Hanzofm

How can I install the 0.9.0-beta.1 with npm?

I could not publish yet on npm because the new plugin id cordova-plugin-local-notification is in use by a fork. I contacted the person without reply yet.

BTW v0.9-beta and Ionic's native wrapper for the plugin aren't compatible yet.

Is normal that if the app is in foreground it not show on ios?

@Hanzofm Yes, because the app is in foreground and the uses does not need to click on the notification to move to the app.

If you want to display the toast anyway, you have to set foreground:true.

@katzer

What log are you asking? How can i check it?

On 21-Nov-2017, at 2:52 PM, Sebastián Katzer <[email protected]notifications@github.com> wrote:

@Hanzofmhttps://github.com/hanzofm Yes, because the app is in foreground and the uses does not need to click on the notification to move to the app.

If you want to display the toast anyway, you have to set foreground:true.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHubhttps://github.com/katzer/cordova-plugin-local-notifications/issues/1422#issuecomment-345965540, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ALsxWUGA4HQqASk5RuUDTdEitzVH7YoEks5s4pZVgaJpZM4QZI8B.

Runtime logs, stack trace, ... from Android Studio or Xcode or Terminal

Sorry @katzer , I don't know how i missed notification.
Here is the log:
log.txt

@joe-mutti

If you want to display the toast anyway, you have to set foreground:true.

"foreground" property doesn't exist on project. It is normal? (v.0.8.5)

@katzer
Any update?

Your logs look ok - Cant reproduce the issue

It looks to be an issue with @ionic-native/local-notifications
I ran into the same issue and solved it using the workaround here: https://github.com/ionic-team/ionic-native/issues/2113#issuecomment-354304949

It looks to be an issue with ionic-native/local-notifications
I ran into the same issue and solved it using the workaround here: https://github.com/ionic-team/ionic-native/issues/2113#issuecomment-354304949

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Ionas83 picture Ionas83  Â·  26Comments

NorthMcCormick picture NorthMcCormick  Â·  23Comments

haha8x picture haha8x  Â·  31Comments

eric-zeng picture eric-zeng  Â·  32Comments

julianlecalvez picture julianlecalvez  Â·  22Comments