katzer / cordova-plugin-local-notifications

Cordova Local-Notification Plugin
Apache License 2.0
2.57k stars 1.76k forks source link

[Question]Common Errors #163

Closed JCVega closed 10 years ago

JCVega commented 10 years ago

I couldn't launch the notification, I have done as say the tutorial, but not run the notification. I don't have any idea because. this my code: HMTL:

    <script type="text/javascript" src="local-notification.js"></script>
    <script type="text/javascript" src="js/index.js"></script>
    <script type="text/javascript">
        app.initialize();
    </script>

JavaScript: onDeviceReady: function() { app.receivedEvent('deviceready');
window.plugin.notification.local.add({ message: 'Great app!' }); }

XML: <?xml version='1.0' encoding='utf-8'?> <widget id="com.example.hello" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0" xmlns:gap = "http://phonegap.com/ns/1.0"

<name>HelloWorld</name>
<description>
    A sample Apache Cordova application that responds to the deviceready event.
</description>
<author email="dev@cordova.apache.org" href="http://cordova.io">
    Apache Cordova Team
</author>
<content src="index.html" />
<access origin="*" />
<gap:plugin name="de.appplant.cordova.plugin.local-notification" version="0.7.2"/>

Sorry I hope not disturb.

katzer commented 10 years ago

Looks like you are trying to include the plugin manually, but the plugin is a Cordova 3 plugin and you have to install it through Cordova CLI.

That does not work and its not necessary:

<script type="text/javascript" src="local-notification.js"></script>

Simple install the plugin with cordova plugin install ... and you can use it after the deviceready event has occurred.

JCVega commented 10 years ago

Ok thanks.