トピックの購読解除
トピックの購読を止めることで、プッシュ通知を止めることができます。
以下に例を挙げます。
-
// Assume that the current user is subscribed to the target topic and // the topic has been instantiated. // Unsubscribe from the topic. var user = KiiUser.getCurrentUser(); user.pushSubscription().unsubscribe(topic).then( function(params) { var thePushSubscription = params[0]; var theTopic = params[1]; // Do something. } ).catch( function(error) { // Handle the error. var thePushSubscription = error.target; var errorString = error.message; } );
-
// Assume that the current user is subscribed to the target topic and // the topic has been instantiated. // Unsubscribe from the topic. var user = KiiUser.getCurrentUser(); user.pushSubscription().unsubscribe(topic, { success: function(thePushSubscription, theTopic) { // Do something. }, failure: function(thePushSubscription, errorString) { // Handle the error. } });
pushSubscription
メソッドを実行してKiiPushSubscription
インスタンスを取得します。- 対象トピックを指定して
unsubscribe
メソッドを実行します。