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

getInstallationObjectId - Asynchronicity issue - Help & Idea

Open nobesio opened this issue 10 years ago • 2 comments

Hey, I was trying to get my Installation Object Id using the method getInstallationObjectId but I am having some problems. If I run it as soon as the app runs it returns null, but what is strange is that the method getInstallationId returns the expected value just right after the app opens without problems. I need the object id in order to make an update in the object and a few more attributes to the installation, like for example the user.

Can someone please help me find the solution?

PD: It would be really cool to have a method call "addAtributeToInstallation" (or something similar) and that given the name of the attribute and the attribute values, it stores it without having to make any HTTP request outside the plugin.

Something like this: window.parsePlugin.addAtributeToInstallation("color, "blue");

Thanks you all very much! Hope someone can help me :)

nobesio avatar May 19 '15 17:05 nobesio

Workaround for that issue

var objectIdInterval = setInterval(function() {
              parsePlugin.getInstallationObjectId(function(id) {
                if (id != null) {
                  console.log(id);

                  clearInterval(objectIdInterval);
                  onIdReceivedFunction(id);
                }
              });
            }, 200);

fastrde avatar Jun 30 '15 15:06 fastrde

I have the same problem. getInstallationObjectId() always returns null while getInstallationId() works fine. Am i just missing something?

ricardocarvalh0 avatar Jan 20 '16 12:01 ricardocarvalh0