Class KiiPushSubscription


  • public class KiiPushSubscription
    extends java.lang.Object
    This class is responsible for the subscription of push notification. Three types of push message supported by KiiCloud.
  • Push to App : Message sent to the subscribers when an event happens in the KiiBucket.
  • Push to User : Message sent to the subscribers of topic that is created explicitly.
  • Following section describes the contents of both event based and explicit push message.
  • Direct Push: Message sent to the app user directly by the app admin
    Subscription is not required to receive this type of push.
    Contents of Push to App Message
    Each Push to App message contains the following information:
    • appID: Source app which generated the notification.
    • sender: The user who caused the notification.
    • when: Timestamp of the notification.
    • origin: Origin of the message. "EVENT" in this case.
    • Type of notification
      • DATA_OBJECT_CREATED New file/object has created.
      • DATA_OBJECT_DELETED A file/object has deleted.
      • DATA_OBJECT_UPDATED File-metadata/object-data has updated.
      • DATA_OBJECT_BODY_UPDATED File/object body has updated.
      • DATA_OBJECT_BODY_DELETED File/object body has deleted.
      • DATA_OBJECT_ACL_MODIFIED ACL of file/object has modified.
    • objectScopeAppID : App ID of bucket.
    • objectScopeUserID : User ID of bucket owner. Push message has this field only if the subscribed bucket is user scoped.
    • objectScopeGroupID : ID of the group that the subscribed bucket belongs to. Push message has this field only if the subscribed bucket is group scoped.
    • objectScopeType: Scope of bucket.
      • APP : Event triggered in app scope bucket.
      • APP_AND_USER : Event triggered in user scope bucket.
      • APP_AND_GROUP : Event triggered in group scope bucket.
    • Collapse Key: Same as bucketID. When the device is offline, and there is already message in gcm server with same collapse key and registration id, old message is collapsed by new message and deliver when the device connects.(i.e. Push message triggered by event occurred in same bucket will be collapsed and only the latest message will be delivered.)
    • bucketID: Bucket name of push subscribed.
    • objectID: ID of the object operated.
    • modifiedAt: Timestamp of the modification of object in milliseconds (Since January 1, 1970 00:00:00 UTC)

    Contents of Push to User Message
    Push to User message contains the basic message as key-value pair that is sent to the topic and KiiCloud specific fields.KiiUser who send the message to the topic can configure KiiCloud specific fields by KiiPushMessage. Push message only contains the KiiCloud specific fields that are selected by the message sender.KiiCloud specific fields are as follows:
    • appID: Source app which generated the notification.
    • sender: The user send message to the topic.
    • origin: Origin of the message. "EXPLICIT" in this case.
    • topic: Topic name in which the message is sent.
    • when: Timestamp of the notification.
    • objectScopeAppID : App ID of topic.
    • objectScopeUserID : ID of the user who own the topic.
    • objectScopeGroupID : ID of the group that own the topic. Push message has this field only if the subscribed topic is group scoped.
    • objectScopeType: Scope of topic.
      • APP : App scope topic.
      • APP_AND_USER : Group scope topic.
      • APP_AND_GROUP : User scope topic.
    • Collapse Key: When the device is offline, and there is already message in gcm server with same collapse key and registration id, old message is collapsed by new message and deliver when the device connects.(i.e. All undelivered topic message will be collapsed and only the latest message will be delivered.)

    Contents of Direct Push
    Direct push message contains the basic message as key-value pair that is sent to the user directly by app admin. In addition, configuration is necessary to set the following fields.
    • sender: originator of the push message.
    • origin: Origin of the message. "EXPLICIT" in this case.
    • when: Timestamp of the notification.