Pushy Me Notification Service With Phonegap Android

                        Pushy (https://pushy.me/) provides reliable Push Notifications.


About Pushy: 

You need an alternative to GCM, Pushy me best way to implement notification service.
Pushy is a push notification gateway, completely independent of GCM. It maintains own background socket connection, Like:  GCM, to receive push notifications.
Light-weight protocol, utilizing very low network bandwidth and battery. It will be perfect for developed case since it does not depend on Google Play Services.

Implement cross platform (Cordova/Phonegap)

1) Setup Account: 

        On Pushyme (https://pushy.me/) create your account and get API Secret Key for server.
            Like:  App Name,  Package Name

       

         
2) Download the Pushy SDK file: 
           
                  Copy the pushy-x.x.x.jar to your Android project's libs/ folder.          
 
3) Add Pushy Permissions to AndroidManifest.xml: 

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
          
4) Add Pushy Receivers to AndroidManifest.xml like bellow: 

    <!-- Pushy Notification Receiver -->
      <!--  Do not modify (except for package name of PushReceiver ) -->
   
    <receiver android:name="com.lokesh.CDVpushyMe.plugin.PushReceiver" >
        <intent-filter>
            <action android:name="pushy.me" />
        </intent-filter>
    </receiver>


5) Add Pushy internal BroadcastReceiver to AndroidManifest.xml 

    <!-- Pushy Update Receiver -->
    <!--  Do not modify (except for package name of path="com.testpushyme") -->
 
    <receiver android:name="me.pushy.sdk.receivers.PushyUpdateReceiver">
        <intent-filter>
            <action android:name="android.intent.action.PACKAGE_REPLACED" />
           
            <data android:path="com.testpushyme" android:scheme="package" />
        </intent-filter>
    </receiver>


6) Add Pushy Boot Receiver to AndroidManifest.xml 

    <!-- Pushy Boot Receiver -->
    <!-- Do not modify - internal BroadcastReceiver that restarts the listener service -->
    <receiver android:name="me.pushy.sdk.receivers.PushyBootReceiver" >
        <intent-filter>
            <action android:name="android.intent.action.BOOT_COMPLETED"/>
        </intent-filter>
    </receiver>
 
7) Add Pushy Socket Service to AndroidManifest.xml  

    <!-- Pushy Socket Service -->
    <!-- Do not modify - internal listener background service -->
    <service android:name="me.pushy.sdk.services.PushySocketService"/>
 
8)  Add Pushy Pushy listen Event on main activity onCreate method 
     CDVPlushyMePlugin.getPushyMelistenEvent(this); 
9)   Create and add Pushy cordova plugin java class:
                       Link :CDVPlushyMePlugin.java 
10) Create and add push receiver class:
                 Link : PushReceiver.java 
11) Add plugin refrence on config.xml class :

  <feature name="CDVPlushyMePlugin">
                <param name="android-package" value="com.lokesh.CDVpushyMe.plugin.CDVPlushyMePlugin"/>
     </feature>
   
12) Create pushme.js file on www/plugins/com-lokesh-pushyme-plugin directory  

       

cordova.define("com-lokesh-pushyme-plugin", function(require, exports, module) {
var exec = require('cordova/exec');
var pushyMeTokenID = function(callbacksucess,callbackfail) {
exec(callbacksucess,callbackfail,"CDVPlushyMePlugin", "pushyMeTokenID", []);
};
module.exports = pushyMeTokenID;
});

13) Call getTokenID and Registraion on Pushy server.

     window.pushyMeTokenID(function success(tokenID){
                    document.getElementById('tokenid').value=tokenID;
                  }, function fail(e){
                     document.getElementById("tokenid_Error").innerHTML ="Error : " + e;
                  });

 
14) Send Push Notification using pushy api :

           https://pushy.me/docs/api/push  add your token id and get notification on your device.

     


Find Source code  : PushymeDemo



Popular posts from this blog

Cordova Plugin Firebase Cloud Messaging For Android

iOS Phonegap app share extension (images) with ionic

Print Hand Plugin With Cordova/PhoneGap For Android.