コード例 #1
0
ファイル: PushManager.java プロジェクト: krainet/android
  /**
   * Unsubscribes from a given Amazon SNS topic.
   *
   * @param topic topic to unsubscribe from
   */
  public void unsubscribeFromTopic(final SnsTopic topic) {
    // Rely on the status stored locally even though it's likely that the device is
    // subscribed to a topic, but the subscription arn is lost, say due to clearing app data.
    if (!topic.isSubscribed()) {
      return;
    }

    final UnsubscribeRequest request = new UnsubscribeRequest();
    request.setSubscriptionArn(topic.getSubscriptionArn());
    sns.unsubscribe(request);

    // update topic and save subscription in shared preferences
    topic.setSubscriptionArn("");
    sharedPreferences.edit().putString(topic.getTopicArn(), "").commit();
  }
コード例 #2
0
 /**
  * Constructs a new UnsubscribeRequest object. Callers should use the setter or fluent setter
  * (with...) methods to initialize any additional object members.
  *
  * @param subscriptionArn The ARN of the subscription to be deleted.
  */
 public UnsubscribeRequest(String subscriptionArn) {
   setSubscriptionArn(subscriptionArn);
 }