bimal chawla
bimal chawla

Reputation: 449

Object ID and Installation ID in parse SDK giving null value

I am trying to get installation id and object id from parse by using below code:

Parse.initialize(this, Constants.PARSE_APPLICATION_ID, Constants.PARSE_CLIENT_KEY);

ParseInstallation.getCurrentInstallation().getObjectId() and 
ParseInstallation.getCurrentInstallation().getInstallationId().

I am using above code in application class of android. both giving me null. and sometimes they give values to me, but not showing its entry in parse console. can anyone please help me this, what exactly wrong i am doing. Thanks in advance.

Upvotes: 1

Views: 1218

Answers (1)

Ved
Ved

Reputation: 1077

First you subscribe for parse push then it update records in Installation table.

ParsePush.subscribeInBackground("APP_NAME");

After subscribing call on Installation to get objectId and installationId.

Your Code like this :

In Your Application class

 Parse.initialize(this, Constants.PARSE_APPLICATION_ID, Constants.PARSE_CLIENT_KEY);
 ParsePush.subscribeInBackground("APP_NAME");

In your Activity where you want to get this id's : ParseInstallation.getCurrentInstallation().getObjectId() and ParseInstallation.getCurrentInstallation().getInstallationId().

Upvotes: 1

Related Questions