程序包 cn.leancloud

类 LCPush


  • public class LCPush
    extends java.lang.Object
    • 构造器概要

      构造器 
      构造器 说明
      LCPush()
      Creates a new push notification.
    • 方法概要

      所有方法 静态方法 实例方法 具体方法 
      修饰符和类型 方法 说明
      void clearExpiration()
      Clears both expiration values, indicating that the notification should never expire.
      java.util.Set<java.lang.String> getChannelSet()
      Return channel set.
      long getExpirationTime()
      Get expiration time.
      long getExpirationTimeInterval()
      Get expiration time interval.
      int getFlowControl()
      Get push flow control value.
      LCObject getNotification()
      Return the instance of _Notification。
      java.util.Map<java.lang.String,​java.lang.Object> getPushData()
      Get push data.
      java.util.Date getPushDate()
      Get push date.
      LCQuery<? extends LCInstallation> getPushQuery()
      Return push query instance.
      java.util.Set<java.lang.String> getPushTarget()
      Get push target.
      void send()
      Sends this push notification while blocking this thread until the push notification has successfully reached the AVOSCloud servers.
      static io.reactivex.Observable<JSONObject> sendDataInBackground​(JSONObject data, LCQuery<? extends LCInstallation> query)
      A helper method to concisely send a push to a query.
      static void sendDataInBackground​(JSONObject data, LCQuery<? extends LCInstallation> query, SendCallback callback)
      A helper method to concisely send a push to a query.
      io.reactivex.Observable<JSONObject> sendInBackground()
      Sends this push notification in a background thread.
      void sendInBackground​(SendCallback callback)
      Sends this push notification in a background thread.
      static io.reactivex.Observable<JSONObject> sendMessageInBackground​(java.lang.String message, LCQuery<? extends LCInstallation> query)
      A helper method to concisely send a push message to a query.
      static void sendMessageInBackground​(java.lang.String message, LCQuery<? extends LCInstallation> query, SendCallback callback)
      A helper method to concisely send a push message to a query.
      void setAPNsTeamId​(java.lang.String APNsTeamId)
      set APNs Team Id(optinal, only used by Token Authentication)
      void setAPNsTopic​(java.lang.String APNsTopic)
      set APNs Topic(optinal, only used by Token Authentication)
      void setChannel​(java.lang.String channel)
      Sets the channel on which this push notification will be sent.
      void setChannels​(java.util.Collection<java.lang.String> channels)
      Sets the collection of channels on which this push notification will be sent.
      void setCloudQuery​(java.lang.String cql)
      可以通过 cql来针对push进行筛选 请注意cql 的主体应该是_Installation表 请在设置cql的同时,不要设置pushTarget(ios,android,wp)
      void setData​(JSONObject data)
      Sets the entire data of the push message.
      void setData​(java.util.Map<java.lang.String,​java.lang.Object> data)
      Sets the entire data of the push message.
      void setExpirationTime​(long time)
      Sets a UNIX epoch timestamp at which this notification should expire, in seconds (UTC).
      void setExpirationTimeInterval​(long timeInterval)
      Sets the time interval after which this notification should expire, in seconds.
      void setFlowControl​(int flowControl)
      set flow control for send speed.
      void setiOSEnvironment​(java.lang.String iOSEnvironment)
      set iOS Environment(optinal, default is production environment).
      void setMessage​(java.lang.String message)
      Sets the message that will be shown in the notification.
      void setNotificationId​(java.lang.String notificationId)
      set notification id(optional).
      void setPushDate​(java.util.Date date)
      Set the push date at which the push will be sent.
      void setPushToAndroid​(boolean pushToAndroid)
      set push target only android device.
      void setPushToIOS​(boolean pushToIOS)
      set push target only ios device.
      void setPushToWindowsPhone​(boolean pushToWP)
      set push target only windows phone device.
      void setQuery​(LCQuery<? extends LCInstallation> query)
      Sets the query for this push for which this push notification will be sent.
      void setRequestId​(java.lang.String requestId)
      set customized request id(optional).
      • 从类继承的方法 java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 字段详细资料

      • iOSEnvironmentDev

        public static final java.lang.String iOSEnvironmentDev
        另请参阅:
        常量字段值
      • iOSEnvironmentProd

        public static final java.lang.String iOSEnvironmentProd
        另请参阅:
        常量字段值
    • 构造器详细资料

      • LCPush

        public LCPush()
        Creates a new push notification. The default channel is the empty string, also known as the global broadcast channel, but this value can be overridden using AVPush.setChannel(String), AVPush.setChannels(Collection) or AVPush.setQuery(AVQuery). Before sending the push notification you must call either AVPush.setMessage(String) or AVPush.setData(JSONObject).
    • 方法详细资料

      • getChannelSet

        public java.util.Set<java.lang.String> getChannelSet()
        Return channel set.
        返回:
        channel set.
      • getNotification

        public LCObject getNotification()
        Return the instance of _Notification。
        返回:
        notification instance.
      • getPushQuery

        public LCQuery<? extends LCInstallation> getPushQuery()
        Return push query instance.
        返回:
        push query instance.
      • getPushDate

        public java.util.Date getPushDate()
        Get push date.
        返回:
        push date
      • getExpirationTime

        public long getExpirationTime()
        Get expiration time.
        返回:
        expiration time
      • getExpirationTimeInterval

        public long getExpirationTimeInterval()
        Get expiration time interval.
        返回:
        expiration time interval
      • getPushTarget

        public java.util.Set<java.lang.String> getPushTarget()
        Get push target.
        返回:
        push target
      • getPushData

        public java.util.Map<java.lang.String,​java.lang.Object> getPushData()
        Get push data.
        返回:
        push data
      • getFlowControl

        public int getFlowControl()
        Get push flow control value.
        返回:
        flow control value.
      • setFlowControl

        public void setFlowControl​(int flowControl)
        set flow control for send speed. flow control value indicates how many devices will be pushed per second. the min value is 1000, if flowControl less than 1000, it will be replaced with 1000.
        参数:
        flowControl - flow control value which stands how many devices will be pushed per second.
        从以下版本开始:
        6.1.2
      • setiOSEnvironment

        public void setiOSEnvironment​(java.lang.String iOSEnvironment)
        set iOS Environment(optinal, default is production environment). When using Token Authentication, this parameter determines which of environment(dev or prod) will become the push target.
        参数:
        iOSEnvironment - iOS environment, allowed values as following: AVPush.iOSEnvironmentDev("dev") - development environment AVPush.iOSEnvironmentProd("prod") - production environment
        从以下版本开始:
        6.5.2
      • setAPNsTopic

        public void setAPNsTopic​(java.lang.String APNsTopic)
        set APNs Topic(optinal, only used by Token Authentication)
        参数:
        APNsTopic - apns topic
        从以下版本开始:
        6.5.2
      • setAPNsTeamId

        public void setAPNsTeamId​(java.lang.String APNsTeamId)
        set APNs Team Id(optinal, only used by Token Authentication)
        参数:
        APNsTeamId - apns team id.
        从以下版本开始:
        6.5.2
      • setNotificationId

        public void setNotificationId​(java.lang.String notificationId)
        set notification id(optional). at now, notification id's max length is 16 characters, only letter and number is valid.
        参数:
        notificationId - customized notification id.
      • setRequestId

        public void setRequestId​(java.lang.String requestId)
        set customized request id(optional). at now, request id's max length is 16 characters, only letter and number is valid. when many requests with the same request id within 5 minutes, only one request works.
        参数:
        requestId - customized request id.
      • setChannel

        public void setChannel​(java.lang.String channel)
        Sets the channel on which this push notification will be sent. The channel name must start with a letter and contain only letters, numbers, dashes, and underscores. A push can either have channels or a query. Setting this will unset the query.
        参数:
        channel - channel string.
      • setChannels

        public void setChannels​(java.util.Collection<java.lang.String> channels)
        Sets the collection of channels on which this push notification will be sent. Each channel name must start with a letter and contain only letters, numbers, dashes, and underscores. A push can either have channels or a query. Setting this will unset the query.
        参数:
        channels - channel collection.
      • setData

        public void setData​(java.util.Map<java.lang.String,​java.lang.Object> data)
        Sets the entire data of the push message. See the push guide for more details on the data format. This will overwrite any data specified in AVPush.setMessage(String).
        参数:
        data - push data.
        从以下版本开始:
        1.4.4
      • setData

        public void setData​(JSONObject data)
        Sets the entire data of the push message. See the push guide for more details on the data format. This will overwrite any data specified in AVPush.setMessage(String).
        参数:
        data - push data.
      • setPushDate

        public void setPushDate​(java.util.Date date)
        Set the push date at which the push will be sent.
        参数:
        date - The push date.
      • setExpirationTime

        public void setExpirationTime​(long time)
        Sets a UNIX epoch timestamp at which this notification should expire, in seconds (UTC). This notification will be sent to devices which are either online at the time the notification is sent, or which come online before the expiration time is reached. Because device clocks are not guaranteed to be accurate, most applications should instead use AVPush.setExpirationTimeInterval(long).
        参数:
        time - timestamp.
      • setExpirationTimeInterval

        public void setExpirationTimeInterval​(long timeInterval)
        Sets the time interval after which this notification should expire, in seconds. This notification will be sent to devices which are either online at the time the notification is sent, or which come online within the given number of seconds of the notification being received by AVOSCloud's server. An interval which is less than or equal to zero indicates that the message should only be sent to devices which are currently online.
        参数:
        timeInterval - time interval.
      • setMessage

        public void setMessage​(java.lang.String message)
        Sets the message that will be shown in the notification. This will overwrite any data specified in AVPush.setData(JSONObject).
        参数:
        message - push message.
      • setPushToAndroid

        public void setPushToAndroid​(boolean pushToAndroid)
        set push target only android device.
        参数:
        pushToAndroid - flag to push to android or not.
      • setPushToIOS

        public void setPushToIOS​(boolean pushToIOS)
        set push target only ios device.
        参数:
        pushToIOS - flag to push to iOS or not.
      • setPushToWindowsPhone

        public void setPushToWindowsPhone​(boolean pushToWP)
        set push target only windows phone device.
        参数:
        pushToWP - flag to push to Windows Phone or not.
      • setQuery

        public void setQuery​(LCQuery<? extends LCInstallation> query)
        Sets the query for this push for which this push notification will be sent. This query will be executed in the AVOSCloud cloud; this push notification will be sent to Installations which this query yields. A push can either have channels or a query. Setting this will unset the channels.
        参数:
        query - A query to which this push should target. This must be a AVInstallation query.
      • setCloudQuery

        public void setCloudQuery​(java.lang.String cql)
        可以通过 cql来针对push进行筛选 请注意cql 的主体应该是_Installation表 请在设置cql的同时,不要设置pushTarget(ios,android,wp)
        参数:
        cql - query cql.
        从以下版本开始:
        2.6.7
      • clearExpiration

        public void clearExpiration()
        Clears both expiration values, indicating that the notification should never expire.
      • send

        public void send()
        Sends this push notification while blocking this thread until the push notification has successfully reached the AVOSCloud servers. Typically, you should use AVPush.sendInBackground() instead of this, unless you are managing your own threading.
      • sendInBackground

        public io.reactivex.Observable<JSONObject> sendInBackground()
        Sends this push notification in a background thread. This is preferable to using send(), unless your code is already running from a background thread.
        返回:
        observable instance.
      • sendInBackground

        public void sendInBackground​(SendCallback callback)
        Sends this push notification in a background thread. This is preferable to using send(), unless your code is already running from a background thread.
        参数:
        callback - callback.done(e) is called when the send completes.
      • sendDataInBackground

        public static void sendDataInBackground​(JSONObject data,
                                                LCQuery<? extends LCInstallation> query,
                                                SendCallback callback)
        A helper method to concisely send a push to a query. This method is equivalent to
         AVPush push = new AVPush();
         push.setData(data);
         push.setQuery(query);
         push.sendInBackground(callback);
         
        参数:
        data - The entire data of the push message. See the push guide for more details on the data format.
        query - A AVInstallation query which specifies the recipients of a push.
        callback - callback.done(e) is called when the send completes.
      • sendDataInBackground

        public static io.reactivex.Observable<JSONObject> sendDataInBackground​(JSONObject data,
                                                                               LCQuery<? extends LCInstallation> query)
        A helper method to concisely send a push to a query. This method is equivalent to
         AVPush push = new AVPush();
         push.setData(data);
         push.setQuery(query);
         push.sendInBackground(callback);
         
        参数:
        data - The entire data of the push message. See the push guide for more details on the data format.
        query - A AVInstallation query which specifies the recipients of a push.
        返回:
        observable instance.
      • sendMessageInBackground

        public static io.reactivex.Observable<JSONObject> sendMessageInBackground​(java.lang.String message,
                                                                                  LCQuery<? extends LCInstallation> query)
        A helper method to concisely send a push message to a query. This method is equivalent to
         AVPush push = new AVPush();
         push.setMessage(message);
         push.setQuery(query);
         push.sendInBackground();
         
        参数:
        message - The message that will be shown in the notification.
        query - A AVInstallation query which specifies the recipients of a push.
        返回:
        observable instance.
      • sendMessageInBackground

        public static void sendMessageInBackground​(java.lang.String message,
                                                   LCQuery<? extends LCInstallation> query,
                                                   SendCallback callback)
        A helper method to concisely send a push message to a query. This method is equivalent to
         AVPush push = new AVPush();
         push.setMessage(message);
         push.setQuery(query);
         push.sendInBackground(callback);
         
        参数:
        message - The message that will be shown in the notification.
        query - A AVInstallation query which specifies the recipients of a push.
        callback - callback.done(e) is called when the send completes.