Android 如何检查I';m已订阅parse.com推送通知
如何检查我是否已订阅pase.com推送通知频道?我在Oncreate方法上有这段代码,但这段代码在每次执行应用程序时都会订阅,我只想在必要时订阅Android 如何检查I';m已订阅parse.com推送通知,android,parse-platform,push-notification,Android,Parse Platform,Push Notification,如何检查我是否已订阅pase.com推送通知频道?我在Oncreate方法上有这段代码,但这段代码在每次执行应用程序时都会订阅,我只想在必要时订阅 protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Parse.enableLocalDatastore(this);
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Parse.enableLocalDatastore(this);
Parse.initialize(this, "iDVqFBKpbYtSRGzeU06WGjDuaCRKOPoCQW9wtdLc", "9Hl628QThttuR8UwidCPijyKZwUdvc4w384Cv522");
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);
}
}
});
}
在安装对象中跟踪对频道的订阅。您可以通过检查
ParseInstallation.getcurrentsinstallation().getJSONArray(“频道”)
中的“频道”数组来检查当前安装是否订阅了频道。到目前为止,您尝试了什么(就检查订阅而言)?我还没有尝试任何操作,因为我在ApiGet和empty JSONArray中没有找到任何内容,所以我不确定它是如何工作的,每次应用程序启动时您都必须使用它,或者在第一次执行应用程序时您已经订阅了它?。