Package com.kii.cloud.storage
Class GCMMessage.Builder
- java.lang.Object
-
- com.kii.cloud.storage.GCMMessage.Builder
-
- Enclosing class:
- GCMMessage
public static class GCMMessage.Builder extends java.lang.Object
Builder of GCMMessage.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description GCMMessage
build()
Build and return GCMMessage.GCMMessage.Builder
delayWhileIdle(boolean delayWhileIdle)
Build with the flag of delay while device is idle.GCMMessage.Builder
enable(boolean enabled)
Set flag of GCM delivery If omit calling this method, GCM delivery is enabled.GCMMessage.Builder
withCollapseKey(java.lang.String collapseKey)
Build with collapse key.GCMMessage.Builder
withGCMData(GCMMessage.GCMData data)
Create a builder with the data that will be sent only to android-GCM devices.GCMMessage.Builder
withRestrictedPackageName(java.lang.String restrictedPackageName)
Send restricted package name which is a string containing the package name of the application.GCMMessage.Builder
withTimeToLive(int timeToLive)
Indicates how long (in seconds) the message should be kept on GCM storage if the device is offline.
-
-
-
Method Detail
-
build
@NonNull public GCMMessage build()
Build and return GCMMessage.- Throws:
java.lang.IllegalStateException
- Thrown if data contains one or more keys that are GCM reserve word mentioned inKiiPushMessage.Data
.
-
enable
@NonNull public GCMMessage.Builder enable(boolean enabled)
Set flag of GCM delivery If omit calling this method, GCM delivery is enabled. IfKiiPushMessage.Builder.enableGCM(boolean)
called afterKiiPushMessage.Builder.withGCMMessage(GCMMessage)
, This property would be overwritten. (The converse also overwrite the property.)- Parameters:
enabled
- if true message would be delivered via GCM. If false, this message would not delivered thru GCM.- Returns:
- Builder of the message
-
withGCMData
@NonNull public GCMMessage.Builder withGCMData(@Nullable GCMMessage.GCMData data)
Create a builder with the data that will be sent only to android-GCM devices. Corresponding to GCM's "data" For details please refer to GCM document
The data specified here will be merged with the data specified onKiiPushMessage.buildWith(Data)
.- Parameters:
data
-KiiPushMessage.Data
GCM specific data.
-
withRestrictedPackageName
@NonNull public GCMMessage.Builder withRestrictedPackageName(@Nullable java.lang.String restrictedPackageName)
Send restricted package name which is a string containing the package name of the application. When set, messages will only be sent to registration IDs that match the package name. Corresponding to GCM's "restricted_package_name" For details please refer to GCM document- Parameters:
restrictedPackageName
- package name.
-
withTimeToLive
@NonNull public GCMMessage.Builder withTimeToLive(int timeToLive)
Indicates how long (in seconds) the message should be kept on GCM storage if the device is offline. Corresponding to GCM's "time_to_live" property. For details please refer to GCM document- Parameters:
timeToLive
- time(in seconds).
-
withCollapseKey
@NonNull public GCMMessage.Builder withCollapseKey(@Nullable java.lang.String collapseKey)
Build with collapse key. Send the message with collapse key which is an arbitrary string that is used to collapse a group of like messages when the device is offline, so that only the last message gets sent to the client. Corresponding to GCM's 'collapse_key' For details please refer to GCM document- Parameters:
collapseKey
- Arbitrary string that is used as collapse key.
-
delayWhileIdle
@NonNull public GCMMessage.Builder delayWhileIdle(boolean delayWhileIdle)
Build with the flag of delay while device is idle. Corresponding to GCM's 'delay_while_idle'. For details please refer to GCM document- Parameters:
delayWhileIdle
- If true, the message will not be sent immediately if the device is idle.
-
-