Hi guys,
I get this error when trying to schedule a local notification.
I am trying very hard to set this up but i still have this message:
[console.log] TypeError: undefined is not an object (evaluating 'cordova.plugins.notification.local')
I am using this version:
phonegap plugin add https://github.com/katzer/cordova-plugin-local-notifications#ios10
The test is been made on "phonegap app" on iphone, but i get the same message testing on a android device.
It seems to be some problem with the plugin instalation, but I did it with the command line above.
onDeviceReady: function() {
var d = new Date();
var now = d.getTime();
try{
cordova.plugins.notification.local.schedule({
id : "2",
at: new Date(now + 10000),
text : "Testing 1..2..3"
});
} catch (e) {
console.log(e);
alert(e);
}
},
iOS or android?
i did have same problem first time i use plugin
You have to be sure that your plugin is well installed
i remmenber after removing adding the platform it does work
if this doesn't work find the javascript of the plugin put a simple alert to be sure that the js is loaded correctly
Uninstall and reinstall the plugin. Something has gone wrong at the sort of level. You also should check the the plugin is initialised.
Normally you just install the plugin and thats it. Sometimes you get a bad download and that screws thing up.
I've never had to reinstall the platform for this plugin. Other plugins yes, but not that one. YMMV.
@rwillett i am not sure if it was or not this plugin :)
so maybe just a "Uninstall and reinstall the plugin " as u said will resolve this problem
If its working I'll close this issue.
@rwillett maybe wait for @acgodoi answer
i just wanted to help him
Sorry, got the wrong person.
I am testing on a iPhone device, via Phonegap APP.
..
This is getting me crazy, because I have tried a lot of thing and it is not working.
...
I created a app by?
phonegap app create testApp
phonegap platform add ios --save
phonegap platform add android --save
phonegap plugin add https://github.com/katzer/cordova-plugin-local-notifications#ios10
...
www/js/index.js
onDeviceReady: function() {
var d = new Date();
var now = d.getTime();
try{
cordova.plugins.notification.local.schedule({
id : "2",
at: new Date(now + 10000),
text : "Testing 1..2..3"
});
} catch (e) {
console.log(e);
alert(e);
}
.....
...
I put some alerts and console.log in the files (but got nothing):
plugins/de.appplant.cordova.plugin.local-notification/www/local-notification.js
plugins/de.appplant.cordova.plugin.local-notification/www/local-notification-core.js
plugins/de.appplant.cordova.plugin.local-notification/www/local-notification-util.js
Fill out #1188 as you gave not provided anywhere near enough information. Also don't use npm to install.
You sound like you are using Phonegap. Are you?
Yes!! I am using Phonegap!!
How can I install not using npm?
[]s
Hi!!
Thank you guys for your patience and here is the form filled.
I would like to know how can i install the plugin not using npm, and the 'best pratices' to get it working fine. I can see people here using it and i'm excidted to use it too. Mobile development is a new world for me.
Plugin version: 0.8.5 (https://github.com/katzer/cordova-plugin-local-notifications#ios10)
Platform: Android / iOS
OS version: Windows 10
Device manufacturer / model: Samsung Galaxy S3 / iPhone 5
Cordova version (cordova -v): (phonegap -v) 6.5.0
Cordova platform version (cordova platform ls):
Installed platforms:
android 6.1.2
browser 4.1.0
ios 4.3.1
Available platforms:
amazon-fireos ~3.6.3 (deprecated)
blackberry10 ~3.8.0
firefoxos ~3.6.3
webos ~3.7.0
windows ~4.4.0
wp8 ~3.8.2 (deprecated)
**Plugin config:**
installed with:
phonegap plugin add https://github.com/katzer/cordova-plugin-local-notifications#ios10
in file INDEX.JS
...
onDeviceReady: function() {
var d = new Date();
var now = d.getTime();
try{
cordova.plugins.notification.local.schedule({
id : "2",
at: new Date(now + 10000),
text : "Testing 1..2..3"
});
} catch (e) {
console.log(e);
alert(e);
}
...
Expected Behavior
Pop up local notification 'Testing 1... 2... 3"
Tell us what should happen
I expect notification to show up.
Actual Behavior
Tell us what happens instead
The code flows to "catch" section and the exception is:
TypeError: undefined is not an object (evaluating 'cordova.plugins.notification.local')
Steps to Reproduce
Put the code above in OnDeviceReady section of index.js
Start up phonegap server with the command:
_phonegap serve_
Access the server via PHONEGAP MOBILE APP
In this point, i get the error:
TypeError: undefined is not an object (evaluating 'cordova.plugins.notification.local')
Reproduce this issue; include code to reproduce, if relevant
Context
What were you trying to do?
Debug logs
I do not use xCode or adb
Include iOS / Android logs
ios XCode logs
Android: $ adb logcat
@acgodoi Installation is fairly straightforward. I use cordova, not phonegap so this is coming from the phonegap documentation. Here’s an outdate link http://docs.phonegap.com/en/3.0.0/guide_cli_index.md.html
What I do is
To verify installation
On Apr 28, 2017, at 6:30 AM, acgodoi notifications@github.com wrote:
Hi!!
Thank you guys for your patience and here is the form filled.
I would like to know how can i install the plugin not using npm, and the 'best pratices' to get it working fine. I can see people here using it and i'm excidted to use it too. Mobile development is a new world for me.
Plugin version: 0.8.5 (https://github.com/katzer/cordova-plugin-local-notifications#ios10)
Platform: Android / iOS
OS version: Windows 10
Device manufacturer / model: Samsung Galaxy S3 / iPhone 5
Cordova version (cordova -v): (phonegap -v) 6.5.0
Cordova platform version (cordova platform ls):
Installed platforms:
android 6.1.2
browser 4.1.0
ios 4.3.1
Available platforms:
amazon-fireos ~3.6.3 (deprecated)
blackberry10 ~3.8.0
firefoxos ~3.6.3
webos ~3.7.0
windows ~4.4.0
wp8 ~3.8.2 (deprecated)Plugin config:
installed with:
phonegap plugin add https://github.com/katzer/cordova-plugin-local-notifications#ios10in file INDEX.JS
...
onDeviceReady: function() {
var d = new Date();
var now = d.getTime();
try{
cordova.plugins.notification.local.schedule({
id : "2",
at: new Date(now + 10000),
text : "Testing 1..2..3"
});
} catch (e) {
console.log(e);
alert(e);
}
...Expected Behavior
Pop up local notification 'Testing 1... 2... 3"
Tell us what should happen
I expect notification to show up.
Actual Behavior
Tell us what happens instead
The code flows to "catch" section and the exception is:
TypeError: undefined is not an object (evaluating 'cordova.plugins.notification.local')Steps to Reproduce
Put the code above in OnDeviceReady section of index.js
Start up phonegap server with the command:
phonegap serveAccess the server via PHONEGAP MOBILE APP
In this point, i get the error:
TypeError: undefined is not an object (evaluating 'cordova.plugins.notification.local')Reproduce this issue; include code to reproduce, if relevant
Context
What were you trying to do?
Debug logsI do not use xCode or adb
Include iOS / Android logs
ios XCode logs
Android: $ adb logcat—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.
@tawpie
I don't use phonegap but this sounds like not checking for device ready. I'd be interested in the response.
Why is onDeviceReady a function on a JSON element? Is that how phonegap does things?
Closed as no update from original poster.
Not working here neither, cordova.plugins is itself always undefined.
Got this issue with Ionic 4, capacitor, iOS and https://github.com/triniwiz/capacitor-datepicker
Fixed it, by removing the compiled ios folder, building again, and adding ios with capacitor again.
Had to fix tiny stuff in Xcode then due to outdated syntax. But overall works now.
Most helpful comment
iOS or android?
i did have same problem first time i use plugin
You have to be sure that your plugin is well installed
i remmenber after removing adding the platform it does work
if this doesn't work find the javascript of the plugin put a simple alert to be sure that the js is loaded correctly