简体   繁体   中英

PhoneGap local notifications not working

I'm checking PhoneGap project via PhoneGap Desktop (Win 10) on a devices with Adobe PhoneGap mobile apps on the systems: Android: 5.1.1, iOS: 10.2.1.

I have this line in config.xml

<plugin name="cordova-plugin-local-notifications" source="npm" />

I can see that files are downloaded in the project's 'plugins' folder.

JavaScript code is:

document.addEventListener('deviceready', function () 
{
    var now = new Date().getTime(),
    _10_seconds_from_now = new Date(now + 10*1000);

    cordova.plugins.notification.local.schedule({
       id:      1,
       title:   'Some Timer',
       message: 'Some Message',
       at:      _10_seconds_from_now
    });

}, false);

Nothing happens at all.

I checked like this:

document.addEventListener('deviceready', function () 
{
    alert(cordova.plugins.notification);
}, false);

and the result is:

Undefined

Hence I couldn't found the plugin in the list:

console.log(JSON.stringify(cordova.plugins));

Strange, but I got only barcodeScanner there, which I'm not using at all. So, as I guess I have more plugins installation problem then coding one.

I tried to use several repositories like

<plugin name="de.appplant.cordova.plugin.local-notification" source="npm" />
<plugin name="cordova-plugin-local-notifications-mm" source="npm" />

Got the same results.

I also built APK on https://build.phonegap.com , just to check if something is wrong with Adobe's PhoneGap mobile apps, APK was made successfully but got the same results - nothing happens at all.

What you might suggest?

As I learned it's PhoneGap Desktop's problem, need to work manually with PhoneGap CLI.

While testing on https://build.phonegap.com need to remember to delete 'plugins' and 'platforms' directories' content and only after it make zip file for an upload.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM