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

余生长醉 提交于 2019-11-30 11:34:25

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.

ameron32

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.

I had the same Exception doing something similar. I save an ACL to the installation when the user logs in to the app with Facebook. (When doing this, the installation doesn't exist at the server yet.)

To get rid of the Exception, I used saveEventually() instead of saveInBackground(). This made the Exception go away, and the installation is saved to the server properly with it's ACL.

Emil Namen

You need to create a class in your project that extends from Application

public class YourApplicationName extends Application  {


  @Override
   public void onCreate() {
    super.onCreate();
    Parse.initialize(this, "", "");
  }
}

Fill the "" with your Parse info

Also add it to the manifest

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!