Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android : Error com.parse.ParseException: at least one ID field (installationId,deviceToken) must be specified in this operation

I am using the parse for push-notification in our application but some problem in registration of device, the error is shown below. There are also problem ,when we send push notification to the device more than one notification received by the device. although we have also upgraded the parse library to the Parse 1.4.1.Please help me,thanks in advance.

Error is shown when app first time installed:

04-14 14:00:40.004: E/LOG(26045): Socket event: onConnect 
04-14 14:00:41.874: E/ParseCommandCache(26045): Failed to run command.
04-14 14:00:41.874: E/ParseCommandCache(26045): com.parse.ParseException: at least one ID field (installationId,deviceToken) must be specified in this operation
04-14 14:00:41.874: E/ParseCommandCache(26045):     at com.parse.ParseCommand$2.then(ParseCommand.java:348)
04-14 14:00:41.874: E/ParseCommandCache(26045):     at com.parse.Task$10.run(Task.java:452)
04-14 14:00:41.874: E/ParseCommandCache(26045):     at com.parse.Task$1.execute(Task.java:68)
04-14 14:00:41.874: E/ParseCommandCache(26045):     at com.parse.Task.completeImmediately(Task.java:448)
04-14 14:00:41.874: E/ParseCommandCache(26045):     at com.parse.Task.continueWith(Task.java:322)
04-14 14:00:41.874: E/ParseCommandCache(26045):     at com.parse.Task.continueWith(Task.java:333)
04-14 14:00:41.874: E/ParseCommandCache(26045):     at com.parse.Task$8.then(Task.java:385)
04-14 14:00:41.874: E/ParseCommandCache(26045):     at com.parse.Task$8.then(Task.java:377)
04-14 14:00:41.874: E/ParseCommandCache(26045):     at com.parse.Task$11.run(Task.java:485)
04-14 14:00:41.874: E/ParseCommandCache(26045):     at com.parse.Task$1.execute(Task.java:68)
04-14 14:00:41.874: E/ParseCommandCache(26045):     at com.parse.Task.completeAfterTask(Task.java:481)
04-14 14:00:41.874: E/ParseCommandCache(26045):     at com.parse.Task.access$300(Task.java:18)
04-14 14:00:41.874: E/ParseCommandCache(26045):     at com.parse.Task$7.then(Task.java:350)
04-14 14:00:41.874: E/ParseCommandCache(26045):     at com.parse.Task$7.then(Task.java:347)
04-14 14:00:41.874: E/ParseCommandCache(26045):     at com.parse.Task.runContinuations(Task.java:514)
04-14 14:00:41.874: E/ParseCommandCache(26045):     at com.parse.Task.access$700(Task.java:18)
04-14 14:00:41.874: E/ParseCommandCache(26045):     at com.parse.Task$TaskCompletionSource.trySetResult(Task.java:569)
04-14 14:00:41.874: E/ParseCommandCache(26045):     at com.parse.Task$TaskCompletionSource.setResult(Task.java:603)
04-14 14:00:41.874: E/ParseCommandCache(26045):     at com.parse.Task$11$1.then(Task.java:497)
04-14 14:00:41.874: E/ParseCommandCache(26045):     at com.parse.Task$11$1.then(Task.java:489)
04-14 14:00:41.874: E/ParseCommandCache(26045):     at com.parse.Task$10.run(Task.java:452)
04-14 14:00:41.874: E/ParseCommandCache(26045):     at com.parse.Task$1.execute(Task.java:68)
04-14 14:00:41.874: E/ParseCommandCache(26045):     at com.parse.Task.completeImmediately(Task.java:448)
04-14 14:00:41.874: E/ParseCommandCache(26045):     at com.parse.Task.access$200(Task.java:18)
04-14 14:00:41.874: E/ParseCommandCache(26045):     at com.parse.Task$6.then(Task.java:315)
04-14 14:00:41.874: E/ParseCommandCache(26045):     at com.parse.Task$6.then(Task.java:312)
04-14 14:00:41.874: E/ParseCommandCache(26045):     at com.parse.Task.runContinuations(Task.java:514)
04-14 14:00:41.874: E/ParseCommandCache(26045):     at com.parse.Task.access$700(Task.java:18)
04-14 14:00:41.874: E/ParseCommandCache(26045):     at com.parse.Task$TaskCompletionSource.trySetResult(Task.java:569)
04-14 14:00:41.874: E/ParseCommandCache(26045):     at com.parse.Task$TaskCompletionSource.setResult(Task.java:603)
04-14 14:00:41.874: E/ParseCommandCache(26045):     at com.parse.Task$11$1.then(Task.java:497)
04-14 14:00:41.874: E/ParseCommandCache(26045):     at com.parse.Task$11$1.then(Task.java:489)
04-14 14:00:41.874: E/ParseCommandCache(26045):     at com.parse.Task$10.run(Task.java:452)
04-14 14:00:41.874: E/ParseCommandCache(26045):     at com.parse.Task$1.execute(Task.java:68)
04-14 14:00:41.874: E/ParseCommandCache(26045):     at com.parse.Task.completeImmediately(Task.java:448)
04-14 14:00:41.874: E/ParseCommandCache(26045):     at com.parse.Task.continueWith(Task.java:322)
04-14 14:00:41.874: E/ParseCommandCache(26045):     at com.parse.Task.continueWith(Task.java:333)
04-14 14:00:41.874: E/ParseCommandCache(26045):     at com.parse.Task$11.run(Task.java:489)
04-14 14:00:41.874: E/ParseCommandCache(26045):     at com.parse.Task$1.execute(Task.java:68)
04-14 14:00:41.874: E/ParseCommandCache(26045):     at com.parse.Task.completeAfterTask(Task.java:481)
04-14 14:00:41.874: E/ParseCommandCache(26045):     at com.parse.Task.access$300(Task.java:18)
04-14 14:00:41.874: E/ParseCommandCache(26045):     at com.parse.Task$7.then(Task.java:350)
04-14 14:00:41.874: E/ParseCommandCache(26045):     at com.parse.Task$7.then(Task.java:347)
04-14 14:00:41.874: E/ParseCommandCache(26045):     at com.parse.Task.runContinuations(Task.java:514)
04-14 14:00:41.874: E/ParseCommandCache(26045):     at com.parse.Task.access$700(Task.java:18)
04-14 14:00:41.874: E/ParseCommandCache(26045):     at com.parse.Task$TaskCompletionSource.trySetResult(Task.java:569)
04-14 14:00:41.874: E/ParseCommandCache(26045):     at com.parse.Task$TaskCompletionSource.setResult(Task.java:603)
04-14 14:00:41.874: E/ParseCommandCache(26045):     at com.parse.Task$3.run(Task.java:228)
04-14 14:00:41.874: E/ParseCommandCache(26045):     at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:422)
04-14 14:00:41.874: E/ParseCommandCache(26045):     at java.util.concurrent.FutureTask.run(FutureTask.java:237)
04-14 14:00:41.874: E/ParseCommandCache(26045):     at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:152)
04-14 14:00:41.874: E/ParseCommandCache(26045):     at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:265)
04-14 14:00:41.874: E/ParseCommandCache(26045):     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
04-14 14:00:41.874: E/ParseCommandCache(26045):     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
04-14 14:00:41.874: E/ParseCommandCache(26045):     at java.lang.Thread.run(Thread.java:841)

Updated code

    Parse.initialize(this, Constant.PARSE_APP_ID, Constant.PARSE_CLIENT_KEY);
    ParseACL defaultACL = new ParseACL();
    defaultACL.setPublicReadAccess(true);
    ParseACL.setDefaultACL(defaultACL, true);
    PushService.setDefaultPushCallback(this, MainActivity.class);
    ParseInstallation.getCurrentInstallation().getInstallationId();
    ParseInstallation.getCurrentInstallation().saveInBackground();

This is the code which I used for the registration on parse.com

   PushService.subscribe(this, "name",Detail.class);

This is the code which i used for the registration of the chanels

like image 967
Mayur Raval Avatar asked Apr 14 '14 10:04

Mayur Raval


2 Answers

Same problem here.
This looked like a race condition to me, so I tried putting setDefaultPushCallback in a new Callback like this:

ParseInstallation.getCurrentInstallation().saveInBackground(new SaveCallback()
{
    @Override
    public void done(ParseException e)
    {
        PushService.setDefaultPushCallback(ParseApplication.this, ParseStarterProjectActivity.class);
    }
});

I haven't had a crash yet (although it hasn't been very long). I hope this helps.

like image 160
ameron32 Avatar answered Oct 12 '22 15:10

ameron32


We had a similar issue:

We had to move the: PushService.setDefaultPushCallback(this, MainActivity.class);

Into the MainActivity#onCreate, we tried calling this in our application class but that cashed.

Parse are really unhelpful on this matter, hopefully one of them and provide some insight.

like image 23
Chris.Jenkins Avatar answered Oct 12 '22 13:10

Chris.Jenkins