StatusBarNotification plugin for Phonegap
Plugin allows you to display notifications in the status bar from your PhoneGap application.
Adding the Plugin to your project
Using this plugin requires Android PhoneGap.
-
To install the plugin, move statusbarnotification.js to your project's www folder and include a reference to it in your html file after phonegap.js.
<script type="text/javascript" charset="utf-8" src="phonegap.js"></script>
<script type="text/javascript" charset="utf-8" src="statusbarnotification.js"></script> -
Create a directory within your project called "src/com/phonegap/plugins/statusBarNotification" and move StatusBarNotification.java into it.
-
Add the following activity to your AndroidManifest.xml file. It should be added inside the <application> tag.
<activity android:name="com.phonegap.DroidGap" android:label="@string/app_name">
<intent-filter>
</intent-filter>
</activity> -
In your res/xml/plugins.xml file add the following line:
<plugin name="StatusBarNotification" value="com.phonegap.plugins.statusBarNotification.StatusBarNotification"/>
Using the plugin
The plugin creates the object window.plugins.statusBarNotification. To use, call one of the following, available methods:
/** * Displays new status bar notification * * @param notificationTitle The url to load * @param notificationBody Load url in PhoneGap webview [optional] - Default: false */ notify(notificationTitle, notificationBody);
Sample use:
window.plugins.statusBarNotification.notify("Put your title here", "Put your message here");