public class LCPush extends Object
Modifier and Type | Field and Description |
---|---|
static String |
iOSEnvironmentDev |
static String |
iOSEnvironmentProd |
Constructor and Description |
---|
LCPush()
Creates a new push notification.
|
Modifier and Type | Method and Description |
---|---|
void |
clearExpiration()
Clears both expiration values, indicating that the notification should never expire.
|
Set<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。
|
Map<String,Object> |
getPushData()
Get push data.
|
Date |
getPushDate()
Get push date.
|
LCQuery<? extends LCInstallation> |
getPushQuery()
Return push query instance.
|
Set<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(String message,
LCQuery<? extends LCInstallation> query)
A helper method to concisely send a push message to a query.
|
static void |
sendMessageInBackground(String message,
LCQuery<? extends LCInstallation> query,
SendCallback callback)
A helper method to concisely send a push message to a query.
|
void |
setAPNsTeamId(String APNsTeamId)
set APNs Team Id(optinal, only used by Token Authentication)
|
void |
setAPNsTopic(String APNsTopic)
set APNs Topic(optinal, only used by Token Authentication)
|
void |
setChannel(String channel)
Sets the channel on which this push notification will be sent.
|
void |
setChannels(Collection<String> channels)
Sets the collection of channels on which this push notification will be sent.
|
void |
setCloudQuery(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(Map<String,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(String iOSEnvironment)
set iOS Environment(optinal, default is production environment).
|
void |
setMessage(String message)
Sets the message that will be shown in the notification.
|
void |
setNotificationId(String notificationId)
set notification id(optional).
|
void |
setPushDate(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(String requestId)
set customized request id(optional).
|
public static final String iOSEnvironmentDev
public static final String iOSEnvironmentProd
public LCPush()
public LCObject getNotification()
public LCQuery<? extends LCInstallation> getPushQuery()
public Date getPushDate()
public long getExpirationTime()
public long getExpirationTimeInterval()
public int getFlowControl()
public void setFlowControl(int flowControl)
flowControl
- flow control value which stands how many devices will be pushed per second.public void setiOSEnvironment(String iOSEnvironment)
iOSEnvironment
- iOS environment, allowed values as following:
AVPush.iOSEnvironmentDev("dev") - development environment
AVPush.iOSEnvironmentProd("prod") - production environmentpublic void setAPNsTopic(String APNsTopic)
APNsTopic
- apns topicpublic void setAPNsTeamId(String APNsTeamId)
APNsTeamId
- apns team id.public void setNotificationId(String notificationId)
notificationId
- customized notification id.public void setRequestId(String requestId)
requestId
- customized request id.public void setChannel(String channel)
channel
- channel string.public void setChannels(Collection<String> channels)
channels
- channel collection.public void setData(Map<String,Object> data)
data
- push data.public void setData(JSONObject data)
data
- push data.public void setPushDate(Date date)
date
- The push date.public void setExpirationTime(long time)
time
- timestamp.public void setExpirationTimeInterval(long timeInterval)
timeInterval
- time interval.public void setMessage(String message)
message
- push message.public void setPushToAndroid(boolean pushToAndroid)
pushToAndroid
- flag to push to android or not.public void setPushToIOS(boolean pushToIOS)
pushToIOS
- flag to push to iOS or not.public void setPushToWindowsPhone(boolean pushToWP)
pushToWP
- flag to push to Windows Phone or not.public void setQuery(LCQuery<? extends LCInstallation> query)
query
- A query to which this push should target. This must be a AVInstallation query.public void setCloudQuery(String cql)
cql
- query cql.public void clearExpiration()
public void send()
public io.reactivex.Observable<JSONObject> sendInBackground()
public void sendInBackground(SendCallback callback)
callback
- callback.done(e) is called when the send completes.public static void sendDataInBackground(JSONObject data, LCQuery<? extends LCInstallation> query, SendCallback callback)
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.public static io.reactivex.Observable<JSONObject> sendDataInBackground(JSONObject data, LCQuery<? extends LCInstallation> query)
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.public static io.reactivex.Observable<JSONObject> sendMessageInBackground(String message, LCQuery<? extends LCInstallation> query)
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.public static void sendMessageInBackground(String message, LCQuery<? extends LCInstallation> query, SendCallback callback)
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.Copyright © 2020, 美味书签(北京)信息技术有限公司 All rights reserved.