danger.net.tpns
Class SubscriptionManager

java.lang.Object
  extended by danger.net.tpns.SubscriptionManager


EXPERIMENTAL Experimental APIs are APIs that are early-stage and not yet finalized or fully qualified. In future releases, these APIs may be changed in incompatible ways, replaced or even removed completely without warning. For these reasons, Danger will not publish applications that use any experimental APIs.

public class SubscriptionManager
extends Object

The SubscriptionManager is used to create and manage a subscription with the TPNS that can be used by third parties to send messages to the device application via the Third Party Notification Service.

Please Note: These APIs are part of a new device-service protocol being implemented for applications.

While these APIs exist in the device OS and are available for future planning purposes, please be aware that the service-side support for these APIs may or may not be in production at this time. Third parties wishing to deploy these APIs in an application are encouraged to contact Danger for implementation requirements.

Since:
4.5
See Also:
Subscription

Method Summary
static void subscribe(String partner, String subscriptionName, Event subKeyEvent, Event notificationEvent)
          EXPERIMENTAL Experimental APIs are APIs that are early-stage and not yet finalized or fully qualified. In future releases, these APIs may be changed in incompatible ways, replaced or even removed completely without warning. For these reasons, Danger will not publish applications that use any experimental APIs.Create a subscription to receive events from the given partner using a unique name.
static void unsubscribe(Subscription subscription)
          EXPERIMENTAL Experimental APIs are APIs that are early-stage and not yet finalized or fully qualified. In future releases, these APIs may be changed in incompatible ways, replaced or even removed completely without warning. For these reasons, Danger will not publish applications that use any experimental APIs.Removes the user's association with the given subscription.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

subscribe

public static void subscribe(String partner,
                             String subscriptionName,
                             Event subKeyEvent,
                             Event notificationEvent)
EXPERIMENTAL Experimental APIs are APIs that are early-stage and not yet finalized or fully qualified. In future releases, these APIs may be changed in incompatible ways, replaced or even removed completely without warning. For these reasons, Danger will not publish applications that use any experimental APIs.
Create a subscription to receive events from the given partner using a unique name. The client will supply an Event that will be called when the subscription key is returned. This Event will be called with the argument containing a Subscription object that contains the subscription key and potentially some partner specific token. If there was an error with the subscription request, then the Subscription object will have a non-zero status code value and the subscription key will be null.

The client should then supply this subscription key to the partner which should use it when sending messages to the TPNS for it to forward to the client. If the partner requires a partner specific token, then that should be supplied as well. Once this subscription information is provisioned with the partner, then the partner can start sending notifications to the client via the TPNS.

When a notification is received by the TPNS, it is forwarded to the client and the notification event supplied by the caller is called. The argument in the event will contain a Notification object.

Parameters:
partner - the name of the partner the client wishes to receive messages from.
subscriptionName - a name to identify the subscription. Typically a login name on the partner system.
subKeyEvent - the event the caller wishes to be called with the unique subscription key that is used by the partner to identify to which subscriber to send a message to.
notificationEvent - the event to call when a message is received from the partner.

unsubscribe

public static void unsubscribe(Subscription subscription)
EXPERIMENTAL Experimental APIs are APIs that are early-stage and not yet finalized or fully qualified. In future releases, these APIs may be changed in incompatible ways, replaced or even removed completely without warning. For these reasons, Danger will not publish applications that use any experimental APIs.
Removes the user's association with the given subscription. The client should also unregister with the third party so it doesn't try to send any messages to the client.

Parameters:
subscription - the Subscription object obtained as a result of the original subscribe call.