现在我正在使用以下代码:
Parse.initialize(this, Constant.PARSE_APPLICATIONID,
Constant.PARSE_CLIENT_KEY);
ParseInstallation installation = ParseInstallation
.getCurrentInstallation();
installation.put(Constant.TAG_USER_OBJECTID, user.getObjectId());
installation.put(Constant.TAG_IS_ENABLED, true);
installation.saveInBackground();
并尝试使用以下代码。
ParsePush.subscribeInBackground("", new SaveCallback() {
@Override
public void done(ParseException e) {
if (e == null) {
Log.d("com.parse.push",
"successfully subscribed to the broadcast channel.");
} else {
Log.e("com.parse.push", "failed to subscribe for push", e);
}
}
});
所以,使用上面的代码我的android设备没有注册到ParseInstallation类。
答案 0 :(得分:2)
我遇到了同样的问题,这就解决了我的问题,请相信我,当你阅读它时你会笑,解析告诉你把它添加到你的gradle中
compile 'com.parse.bolts:bolts-android:1.+'
compile 'com.parse:parse-android:1.+'
实际上你必须加上这个(当时我做的那些是当前的版本,如果你在不远的将来会尝试与你的相同)
compile 'com.parse.bolts:bolts-android:1.3.0'
compile 'com.parse:parse-android:1.12.0'
这解决了我的问题,我希望它也能帮到你。
答案 1 :(得分:1)
创建一个类应用程序从android.app.Application扩展并覆盖onCreate方法在这个onCreate中初始化你的解析就像这样......
public class Application extends android.app.Application {
@Override
public void onCreate() {
super.onCreate();
Parse.initialize(this, MainActivity.APP_ID, MainActivity.CLIENT_KEY);
}
}