トピックの購読解除
トピックの購読を止めることで、プッシュ通知を止めることができます。
以下に例を挙げます。
-
// Assume that the current user is subscribed to the target topic and // the topic has been instantiated. try { // Unsubscribe from the topic. KiiUser user = KiiUser.getCurrentUser(); KiiPushSubscription sub = user.pushSubscription(); sub.unsubscribe(topic); } catch (IOException ioe) { // Handle the error. } catch (AppException e) { // Handle the error. }
-
// Assume that the current user is subscribed to the target topic and // the topic has been instantiated. // Unsubscribe from the topic. KiiUser user = KiiUser.getCurrentUser(); KiiPushSubscription sub = user.pushSubscription(); sub.unsubscribe(topic, new KiiPushCallBack() { @Override public void onUnSubscribeCompleted(int taskId, KiiSubscribable target, Exception exception) { if (exception != null) { // Handle the error. return; } } });
- 購読を止めるユーザーの
pushSubscription
メソッドを実行し、KiiPushSubscription インスタンスを取得。 - 対象トピックを指定して KiiPushSubscription の
unsubscribe
メソッドを実行。