avivais / phonegap-parse-plugin

Phonegap 3.0.0 plugin for Parse.com push service
195 stars 315 forks source link

Unable to subscribe to a channel #65

Open billymedia opened 9 years ago

billymedia commented 9 years ago

I have it installed and registering ok in android / cordova 3 / angular 1.3.6 / parse js sdk 1.4.1.

Once registered, i have a toggle that allows the user to subscribe/unsubscribe to a channel. I am unable to subscribe to a channel, there is no error returned.

This is my subscribe code :

                parsePlugin.subscribe('user_123', function() {
                    console.log('PN complete'); // i can see this in the console, yet channels in parse.com is empty
                }, function(e) {
                    console.log('PN1 ERROR',e);
                });

As i can register, i assume the plugin is installed ok and connecting to parse.com with the app id and client key. Can you think of a reason why it wont subscribe?

Note that I did not implement the "Android Quirk" as it threw an error on cordova build, but i can see in a pull request that this is no longer needed.

vineshhpatel commented 9 years ago

Having same issue. I even get the success callback called.

billymedia commented 9 years ago

I have ended up subscribing/unsubscribing manually via Parse queries:

parsePlugin.initialize(*APP_ID*,*CLIENT_KEY*, function() {
    parsePlugin.getInstallationId(function(id) {
        var installationQuery = new Parse.Query(Parse.Installation);
        installationQuery.equalTo('installationId', id);
        return installationQuery.first().then(function(installation) {
            installation.set('channels', ['user_123']);
            installation.save();
        });
    }, function(e) {
        console.log('ID ERROR',e);
    });
}, function(e) {
    console.log('INIT ERROR',e);
});
anteksiler commented 9 years ago

@billymedia Hi there, where can read about installation.set and save methods?

MarcBT commented 9 years ago

@anteksiler These methods come from BackboneJS which is used by Parse JS SDK.

dcdrns commented 8 years ago

I had this same problem. This plugin -> https://github.com/denisbabineau/phonegap-parse-plugin solved my problem. Use following command to install the plugin. cordova plugin add https://github.com/denisbabineau/phonegap-parse-plugin --variable APP_ID=PARSE_APP_ID --variable CLIENT_KEY=PARSE_CLIENT_KEY --variable JS_KEY=PARSE_JS_KEY