Skip to content

JUN-KOBAYASHI/monaca_push_plugin

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

#Nifty Cloud for Push Notification Plugin


Specifications

  • PhoneGap/Cordova 5.2 ~
  • iOS/Android

Methods

###window.NCMB.monaca.setDeviceToken(applicationKey,clientKey,senderId, successCallback, errorCallback)

Register device-token to Nifty cloud mobile backend datastore (Installation class).

  • (String)applicationKey
  • (String)clientKey
  • (String)senderId
  • (Function)successCallback() (OPTIONAL)
  • (Function)errorCallback(error) (OPTIONAL)

###window.NCMB.monaca.setHandler(callback)

Set the callback when app receive a push notification.

  • (function)callback(jsonData)

###window.NCMB.monaca.getInstallationId(callback)

Get the Installation objectId for device.

  • (function)callback(installationId)

###window.NCMB.monaca.setReceiptStatus(flag, callback);

Set the notification open receipt status to be store or not. This status will be used to create Push notification open status statistic graph.

  • (Boolean) flag
    • true : Send receipt to server
    • false : No send
  • (Function) callback() (OPTIONAL)

###window.NCMB.monaca.getReceiptStatus(callback);

Get the notification open receipt status.

  • (function)callback(flag)

Sample

    <!DOCTYPE HTML>
    <html>
    <head>
        <meta charset="utf-8">
        <script src="cordova.js"></script>
        <script>
            document.addEventListener("deviceready", function() {
                NCMB.monaca.setDeviceToken(
                    "#####application_key#####",
                    "#####client_key#####",
                    "#####sender_id#####"
                );

                // Set callback for push notification data.
                NCMB.monaca.setHandler(function(jsonData){
                    alert("callback :::" + JSON.stringify(jsonData));
                });

                // Get installation ID.
                NCMB.monaca.getInstallationId(function(installationId){
                    // something
                });

                // Get receipt status
                NCMB.monaca.getReceiptStatus(function(status){
                    // status = true or false
                });

                // Set receipt status
                NCMB.monaca.setReceiptStatus(true);

            },false);                
        </script>
    </head>
    <body>

    <h1>PushNotification Sample</h1>

    </body>
    </html>

License

Please read LICENSE file.

About

Monaca push plugin

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Objective-C 93.4%
  • C 3.8%
  • Java 2.0%
  • Other 0.8%