katzer / cordova-plugin-local-notifications

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

Android Notification console.log not showing #46

Closed clonez closed 10 years ago

clonez commented 10 years ago

Hi katzer,

am I missing out something else, did follow the examples and cordova added the plugins. But theres no log from the notification plugin. It shows error on "Uncaught TypeError: Cannot read property 'notification' of undefined"

katzer commented 10 years ago

Where does the error occurs, file & line? Sounds like JavaScript. May you could post your code?

clonez commented 10 years ago

its the example of your code which fires every 60 secs from now:

var now = new Date().getTime(), _60_seconds_from_now = new Date(now + 60*1000);

window.plugin.notification.local.add({ id: 1, // is converted to a string title: 'Reminder', message: 'Dont forget to buy some flowers.', repeat: 'weekly', date: _60_seconds_from_now, foreground: 'foreground', background: 'background' });

function foreground (id) { console.log('I WAS RUNNING ID='+id) }

function background (id) { console.log('I WAS IN THE BACKGROUND ID='+id) }

below upon the error mention from the adt's LogCat: screen shot 2014-01-03 at 1 31 19 am

katzer commented 10 years ago

are you calling the code after the devicereadyevent?

clonez commented 10 years ago

inside the onDeviceReady event on index.js. Actually tried after deviceready event too, same error mention the above attached

clonez commented 10 years ago

Hi katzer any solution for this?

katzer commented 10 years ago

To me it looks like the plugin isn't installed properly. Have you installed the plugin through cordova plugin add ...? In your cordova_plugins.js the plugin should be listed like this:

cordova.define('cordova/plugin_list', function(require, exports, module) {
module.exports = [
    {
        "file": "plugins/de.appplant.cordova.plugin.local-notification/www/local-notification.js",
        "id": "de.appplant.cordova.plugin.local-notification.LocalNotification",
        "clobbers": [
            "plugin.notification.local"
        ]
    },
    ...
]
clonez commented 10 years ago

the plugin has been already added before I try out the example (screenshot) screen shot 2014-01-05 at 2 20 41 am

I've ammend the cordova_plugins.js as the above follows, however the issue same appears screen shot 2014-01-05 at 2 25 40 am

theres new error: "Unable to open asset URL"

katzer commented 10 years ago

Strange, does the local_notification.js file exist? Have you tried to reinstall the plugin?

clonez commented 10 years ago

tried reinstall, local-notification.js file does exist. screen shot 2014-01-05 at 6 27 58 pm

katzer commented 10 years ago

thats the plugin folder. But the log says, that the js file inside your project cannout be found: www/plugins/de.appplant.cordova.plugin.local-notification/www/local-notification.js

Have you added android as a platform through the CLI as well? cordova platform add android

clonez commented 10 years ago

I did add Android platform before started, its "android 3.3.0-rc1" screen shot 2014-01-06 at 4 12 50 pm

katzer commented 10 years ago

Dont whats the reason for that issue. Are you sure that the plugin source was copied into the project under /src and /assets?