phonegap-parse-plugin icon indicating copy to clipboard operation
phonegap-parse-plugin copied to clipboard

Subscriptions not being created

Open rorymadden opened this issue 10 years ago • 2 comments

I can connect to the parse plugin and get the installation id but the subscriptions never get saved.

The code below outputs: Successfully connected to parse plugin Installation id: 123456 subscriptions: [] subscribed to own channel: userJ123 subscriptions: []

    window.parsePlugin.initialize('abcdef', '123456',
      function(success) {
        console.log('Successfully connected to parse plugin');
        // alert('success');
        window.parsePlugin.getInstallationId(function(id) {
          installationId = id;
          console.log('Installation Id' + installationId);
          window.parsePlugin.getSubscriptions(function(subs) {
            subscriptions = subs;
            console.log('subscriptions: ' + subs);

            // subscribe user to itself
            var userChannel = 'user' + Parse.User.current().id;
            if (subscriptions.indexOf(userChannel) === -1) {
              window.parsePlugin.subscribe(userChannel, function() {
                console.log('subscribed to own channel: ' + userChannel);

                // Test that subscribe is working
                window.parsePlugin.getSubscriptions(function(subs) {
                  console.log('subscriptions: ' + subs);
                });
              }, function (e) {
                console.log('error subscribing to own channel' + e);
              });
            }
            console.log('subscriptions:', subs);
          }, function (e) {
            console.log('error' + e);
          });
        }, function(e) {
          console.log('Error Getting ID: ' + e.code + ' : ' + e.message);
        });

      }, function(e) {
        // alert('error');
        console.log('error connecting to push with code: ' + e);
      });

Am I supposed to pass the installation id to the subscribe method?

Thanks in advance.

rorymadden avatar Sep 05 '14 07:09 rorymadden

Same issue here

Nivl avatar Oct 17 '14 22:10 Nivl

This might be an issue if you are using a version of parse newer than 1.3.8. I've updated the plugin to work for parse 1.7 here https://github.com/ghmeier/phonegap-parse-plugin

ghmeier avatar Dec 12 '14 18:12 ghmeier