grrrian/phonegap-parse-plugin

Update Plugin to allow use of ParseServer

Opened this issue · 3 comments

This plugin needs to be updated to allow use of the open-source ParseServer, i.e. specify a custom Parse API URL to allow app to connect to self-hosted mongo database.

+1 Bump. please

Solution found : https://github.com/otmezger/parse-push-plugin

Install with : cordova plugin add https://github.com/otmezger/parse-push-plugin --variable APP_ID=myapp --variable CLIENT_KEY=123456 --variable SENDER_ID="987654" --verbose

Addto your JS :

 //Parse
   parsePlugin.register({
    appId:"myapp", clientKey:"1234", server:"https://api.example.com:1337/parse", ecb:"onNotification", pushOpen: "onPushOpen" },
    function() {
        //alert('successfully registered device!');
        doWhatever();
    }, function(e) {
        alert('error registering device: ' + e);
    });

    function doWhatever(){
        parsePlugin.getInstallationId(function(id) {
           // alert(id);
        }, function(e) {
            alert('error');
        });

        parsePlugin.getSubscriptions(function(subscriptions) {
           // alert(subscriptions);
        }, function(e) {
            alert('error');
        });

        parsePlugin.subscribe('SampleChannel', function() {
            //alert('OK');
        }, function(e) {
            alert('error');
        });

        parsePlugin.unsubscribe('SampleChannel', function(msg) {
           // alert('OK');
        }, function(e) {
            alert('error');
        });
    }

    function onNotification(pnObj){
        alert("received pn: " + JSON.stringify(pnObj));
    }

    function onPushOpen(pnObj){
        alert("open from pn: " + JSON.stringify(pnObj));
    }
    //Parse