Giter Club home page Giter Club logo

phonegap-localnotification's Introduction

Cordova/PhoneGap Local Notification Plugin

A Cordova/PhoneGap 3.0.0+ plugin to create local notifications on iOS and Android.

iOS version originally by Olivier Lesnicki. Android version originally by Drew Dahlman.

Changes

  • Rationalize iOS/Android parameters
  • Support notifification icon - Android
  • Tap Notifification to open app - Android
  • Add other repeat periods - Android

TO DO

  • Test ios changes

Installing the plugin

Install the core plugin files via the Command-line Interface:

$ phonegap plugin add https://github.com/gsmedley/Phonegap-LocalNotification.git

Using the plugin

Within the www/js/index.js file, or any other included js files, the following will trigger a local notification after 5 seconds:

localNotifier.addNotification({
    date            : new Date(new Date().getTime() + 5000),
    message         : "This is a local notification.",
    id              : '1'  , // reusing an id will replace an existing notification
    repeat          : "" ,  // minute, hour, day, week

    // android only
    ticker          : "Alarm Ticker",
    icon            : "small_notification_icon",  // resource name

    // ios only
    sound           : "horn.caf" , // name of sound file
    hasAction       : true,
    action          : 'View',
    badge           : 0 ,        
    background      : function(notificationId){  console.log( "addNotification background callback") },
    foreground      : function(notificationId){   console.log( "addNotification foreground callback")  }
});

To cancel a notification:

localNotifier.cancelNotification(1);

To cancel all notifications:

localNotifier.cancelAllNotifications();

Uninstalling the plugin

To uninstall the plugin and its components, use:

$ phonegap plugin remove localnotification

phonegap-localnotification's People

Contributors

boennemann avatar dduan avatar dmotz avatar drewdahlman avatar hiattp avatar joerodriguez avatar yjukaku avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.