Class GCMMessage.GCMData

  • Enclosing class:
    GCMMessage

    public static class GCMMessage.GCMData
    extends KiiPushMessage.Data
    Represent data to be delivered to GCM device. It contains a JSON object whose field represents key-value pairs of message's payload Key can not be a reserved word listed bellow:
    • any key starts with 'google'
    • from
    • registration_ids
    • collapse_key
    • data
    • delay_while_idle
    • time_to_live
    • restricted_package_name
    • dry_run
    • Constructor Summary

      Constructors 
      Constructor Description
      GCMData()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected boolean _isValidKey​(java.lang.String key)  
      static boolean isValidKey​(java.lang.String key)
      Checks whether the key is valid.
      void put​(java.lang.String key, boolean value)
      Put boolean value to the data.
      void put​(java.lang.String key, double value)
      Put double value to the data.
      void put​(java.lang.String key, int value)
      Put int value to the data.
      void put​(java.lang.String key, long value)
      Put long value to the data.
      void put​(java.lang.String key, java.lang.String value)
      Put String value to the data.
      • Methods inherited from class java.lang.Object

        clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • GCMData

        public GCMData()
    • Method Detail

      • put

        public void put​(@NonNull
                        java.lang.String key,
                        int value)
        Put int value to the data.
        Overrides:
        put in class KiiPushMessage.Data
        Parameters:
        key - when the same value specified, overwrite existing value.
        value - int value.
        Throws:
        java.lang.IllegalArgumentException - when the specified key is null, empty or reserve key mentioned in KiiPushMessage.Data.
      • put

        public void put​(@NonNull
                        java.lang.String key,
                        long value)
        Put long value to the data.
        Overrides:
        put in class KiiPushMessage.Data
        Parameters:
        key - when the same value specified, overwrite existing value.
        value - long value.
        Throws:
        java.lang.IllegalArgumentException - when the specified key is null, empty or reserve key mentioned in KiiPushMessage.Data.
      • put

        public void put​(@NonNull
                        java.lang.String key,
                        double value)
        Put double value to the data.
        Overrides:
        put in class KiiPushMessage.Data
        Parameters:
        key - when the same value specified, overwrite existing value.
        value - double value.
        Throws:
        java.lang.IllegalArgumentException - when the specified key is null, empty or reserve key mentioned in KiiPushMessage.Data.
      • put

        public void put​(@NonNull
                        java.lang.String key,
                        boolean value)
        Put boolean value to the data.
        Overrides:
        put in class KiiPushMessage.Data
        Parameters:
        key - when the same value specified, overwrite existing value.
        value - boolean value.
        Throws:
        java.lang.IllegalArgumentException - when the specified key is null, empty or reserve key mentioned in KiiPushMessage.Data.
      • put

        public void put​(@NonNull
                        java.lang.String key,
                        @Nullable
                        java.lang.String value)
        Put String value to the data.
        Overrides:
        put in class KiiPushMessage.Data
        Parameters:
        key - when the same value specified, overwrite existing value.
        value - string value.
        Throws:
        java.lang.IllegalArgumentException - when the specified key is null, empty or reserve key mentioned in KiiPushMessage.Data.
      • isValidKey

        public static boolean isValidKey​(@Nullable
                                         java.lang.String key)
        Checks whether the key is valid.
        Parameters:
        key - to be checked.
        Returns:
        true for valid key. Return false when the specified key is null or empty.