public class Push extends Object
Modifier and Type | Field and Description |
---|---|
static String |
GOOGLE_PUSH_KEY
Key for the hashtable argument when pushing to the google play store
|
Constructor and Description |
---|
Push(String token,
String body,
String... deviceKeys)
Creates a new push notification.
|
Modifier and Type | Method and Description |
---|---|
Push |
apnsAuth(String iosCertificateURL,
String iosCertificatePassword,
boolean production)
Sets authentication for APNS (iOS)
|
Push |
gcmAuth(String googleAuthKey)
Sets authentication for GMS (Android and Chrome)
|
static String |
getDeviceKey()
Deprecated.
this method sends a push using the old push servers which will be retired, you need to switch
to getPushKey()
|
static String |
getPushKey()
Returns the push device key if the device was previously successfully registered for push
otherwise returns null
|
Push |
pushType(int pushType)
Sets the type of push to use.
|
boolean |
send()
Sends push message.
|
void |
sendAsync()
Sends push message asynchronously.
|
static boolean |
sendPushMessage(String body,
String deviceKey,
boolean production,
String googleAuthKey,
String iosCertificateURL,
String iosCertificatePassword)
Deprecated.
this method sends a push using the old push servers which will be retired, you need to switch
to the equivalent method that accepts a push token
|
static boolean |
sendPushMessage(String token,
String body,
boolean production,
String googleAuthKey,
String iosCertificateURL,
String iosCertificatePassword,
int pushType,
String... deviceKey)
Deprecated.
Please use new builder syntax with
send() which includes parameters for new platforms such as UWP. |
static boolean |
sendPushMessage(String body,
String deviceKey,
boolean production,
String googleAuthKey,
String iosCertificateURL,
String iosCertificatePassword,
String bbUrl,
String bbApp,
String bbPass,
String bbPort)
Deprecated.
this method sends a push using the old push servers which will be retired, you need to switch
to the equivalent method that accepts a push token
|
static boolean |
sendPushMessage(String token,
String body,
String deviceKey,
boolean production,
String googleAuthKey,
String iosCertificateURL,
String iosCertificatePassword)
Deprecated.
Please use new builder syntax with
send() which includes parameters for new platforms such as UWP. |
static boolean |
sendPushMessage(String token,
String body,
String deviceKey,
boolean production,
String googleAuthKey,
String iosCertificateURL,
String iosCertificatePassword,
String bbUrl,
String bbApp,
String bbPass,
String bbPort)
Deprecated.
Please use new builder syntax with
send() which includes parameters for new platforms such as UWP. |
static void |
sendPushMessageAsync(String body,
String deviceKey,
boolean production,
String googleAuthKey,
String iosCertificateURL,
String iosCertificatePassword)
Deprecated.
this method sends a push using the old push servers which will be retired, you need to switch
to the equivalent method that accepts a push token
|
static void |
sendPushMessageAsync(String body,
String deviceKey,
boolean production,
String googleAuthKey,
String iosCertificateURL,
String iosCertificatePassword,
String bbUrl,
String bbApp,
String bbPass,
String bbPort)
Deprecated.
this method sends a push using the old push servers which will be retired, you need to switch
to the equivalent method that accepts a push token
|
static void |
sendPushMessageAsync(String token,
String body,
String deviceKey,
boolean production,
String googleAuthKey,
String iosCertificateURL,
String iosCertificatePassword)
Deprecated.
Please use new builder syntax with
sendAsync() which includes parameters for new platforms such as UWP. |
static void |
sendPushMessageAsync(String token,
String body,
String deviceKey,
boolean production,
String googleAuthKey,
String iosCertificateURL,
String iosCertificatePassword,
String bbUrl,
String bbApp,
String bbPass,
String bbPort)
Deprecated.
Please use new builder syntax with
sendAsync() which includes parameters for new platforms such as UWP. |
Push |
wnsAuth(String wnsSID,
String wnsClientSecret)
Sets authenticaton for WNS (Windows 10/UWP)
|
public static final String GOOGLE_PUSH_KEY
public Push(String token, String body, String... deviceKeys)
token
- the authorization token from the account settings in the CodenameOne website, this is used
to associate push quotas with your appbody
- the body of the messagedeviceKeys
- Device keys when sending to specific devices.public Push gcmAuth(String googleAuthKey)
googleAuthKey
- authorization key from the google play storepublic Push apnsAuth(String iosCertificateURL, String iosCertificatePassword, boolean production)
iosCertificateURL
- a URL where you host the iOS certificate for this applications push capabilities.iosCertificatePassword
- the password for the push certificateproduction
- True if this is a production certificate. False if this is a development certificate.public Push wnsAuth(String wnsSID, String wnsClientSecret)
wnsSID
- The SID from the Windows store.wnsClientSecret
- The client secret from the windows storepublic Push pushType(int pushType)
pushType
- public boolean send()
public void sendAsync()
public static boolean sendPushMessage(String body, String deviceKey, boolean production, String googleAuthKey, String iosCertificateURL, String iosCertificatePassword)
body
- the body of the messagedeviceKey
- an optional parameter (can be null) when sending to a specific deviceproduction
- whether pushing to production or test/sandbox environmentgoogleAuthKey
- authorization key from the google play storeiosCertificateURL
- a URL where you host the iOS certificate for this applications push capabilities.iosCertificatePassword
- the password for the push certificatepublic static boolean sendPushMessage(String body, String deviceKey, boolean production, String googleAuthKey, String iosCertificateURL, String iosCertificatePassword, String bbUrl, String bbApp, String bbPass, String bbPort)
body
- the body of the messagedeviceKey
- an optional parameter (can be null) when sending to a specific deviceproduction
- whether pushing to production or test/sandbox environmentgoogleAuthKey
- authorization key from the google play storeiosCertificateURL
- a URL where you host the iOS certificate for this applications push capabilities.iosCertificatePassword
- the password for the push certificatebbUrl
- the URL to which the push should be submitted when sending a blackberry push for evaluation use https://pushapi.eval.blackberry.com
for production you will need to apply at https://cp310.pushapi.na.blackberry.combbApp
- the application id to authenticate on push for RIM devicesbbPass
- the application password credentials authenticate on push for RIM devicesbbPort
- the port of the blackberry pushpublic static void sendPushMessageAsync(String body, String deviceKey, boolean production, String googleAuthKey, String iosCertificateURL, String iosCertificatePassword)
body
- the body of the messagedeviceKey
- an optional parameter (can be null) when sending to a specific deviceproduction
- whether pushing to production or test/sandbox environmentgoogleAuthKey
- authorization key from the google play storeiosCertificateURL
- a URL where you host the iOS certificate for this applications push capabilities.iosCertificatePassword
- the password for the push certificatepublic static void sendPushMessageAsync(String body, String deviceKey, boolean production, String googleAuthKey, String iosCertificateURL, String iosCertificatePassword, String bbUrl, String bbApp, String bbPass, String bbPort)
body
- the body of the messagedeviceKey
- an optional parameter (can be null) when sending to a specific deviceproduction
- whether pushing to production or test/sandbox environmentgoogleAuthKey
- authorization key from the google play storeiosCertificateURL
- a URL where you host the iOS certificate for this applications push capabilities.iosCertificatePassword
- the password for the push certificatebbUrl
- the URL to which the push should be submitted when sending a blackberry push for evaluation use https://pushapi.eval.blackberry.com
for production you will need to apply at https://cp310.pushapi.na.blackberry.combbApp
- the application id to authenticate on push for RIM devicesbbPass
- the application password credentials authenticate on push for RIM devicesbbPort
- the port of the blackberry pushpublic static String getDeviceKey()
public static String getPushKey()
public static boolean sendPushMessage(String token, String body, String deviceKey, boolean production, String googleAuthKey, String iosCertificateURL, String iosCertificatePassword)
send()
which includes parameters for new platforms such as UWP.token
- the authorization token from the account settings in the CodenameOne website, this is used
to associate push quotas with your appbody
- the body of the messagedeviceKey
- the device key that will receive the push message (can't be null!)production
- whether pushing to production or test/sandbox environmentgoogleAuthKey
- authorization key from the google play storeiosCertificateURL
- a URL where you host the iOS certificate for this applications push capabilities.iosCertificatePassword
- the password for the push certificatepublic static boolean sendPushMessage(String token, String body, boolean production, String googleAuthKey, String iosCertificateURL, String iosCertificatePassword, int pushType, String... deviceKey)
send()
which includes parameters for new platforms such as UWP.token
- the authorization token from the account settings in the CodenameOne website, this is used
to associate push quotas with your appbody
- the body of the messageproduction
- whether pushing to production or test/sandbox environmentgoogleAuthKey
- authorization key from the google play storeiosCertificateURL
- a URL where you host the iOS certificate for this applications push capabilities.iosCertificatePassword
- the password for the push certificatepushType
- the type for the push in the server, this is useful for sending hidden pushes (type 2) should default
to 0 or 1deviceKey
- set of devices that should receive the pushpublic static boolean sendPushMessage(String token, String body, String deviceKey, boolean production, String googleAuthKey, String iosCertificateURL, String iosCertificatePassword, String bbUrl, String bbApp, String bbPass, String bbPort)
send()
which includes parameters for new platforms such as UWP.token
- the authorization token from the account settings in the CodenameOne website, this is used
to associate push quotas with your appbody
- the body of the messagedeviceKey
- an optional parameter (can be null) when sending to a specific deviceproduction
- whether pushing to production or test/sandbox environmentgoogleAuthKey
- authorization key from the google play storeiosCertificateURL
- a URL where you host the iOS certificate for this applications push capabilities.iosCertificatePassword
- the password for the push certificatebbUrl
- the URL to which the push should be submitted when sending a blackberry push for evaluation use https://pushapi.eval.blackberry.com
for production you will need to apply at https://cp310.pushapi.na.blackberry.combbApp
- the application id to authenticate on push for RIM devicesbbPass
- the application password credentials authenticate on push for RIM devicesbbPort
- the port of the blackberry pushpublic static void sendPushMessageAsync(String token, String body, String deviceKey, boolean production, String googleAuthKey, String iosCertificateURL, String iosCertificatePassword)
sendAsync()
which includes parameters for new platforms such as UWP.token
- the authorization token from the account settings in the CodenameOne website, this is used
to associate push quotas with your appbody
- the body of the messagedeviceKey
- an optional parameter (can be null) when sending to a specific deviceproduction
- whether pushing to production or test/sandbox environmentgoogleAuthKey
- authorization key from the google play storeiosCertificateURL
- a URL where you host the iOS certificate for this applications push capabilities.iosCertificatePassword
- the password for the push certificatepublic static void sendPushMessageAsync(String token, String body, String deviceKey, boolean production, String googleAuthKey, String iosCertificateURL, String iosCertificatePassword, String bbUrl, String bbApp, String bbPass, String bbPort)
sendAsync()
which includes parameters for new platforms such as UWP.token
- the authorization token from the account settings in the CodenameOne website, this is used
to associate push quotas with your appbody
- the body of the messagedeviceKey
- an optional parameter (can be null) when sending to a specific deviceproduction
- whether pushing to production or test/sandbox environmentgoogleAuthKey
- authorization key from the google play storeiosCertificateURL
- a URL where you host the iOS certificate for this applications push capabilities.iosCertificatePassword
- the password for the push certificatebbUrl
- the URL to which the push should be submitted when sending a blackberry push for evaluation use https://pushapi.eval.blackberry.com
for production you will need to apply at https://cp310.pushapi.na.blackberry.combbApp
- the application id to authenticate on push for RIM devicesbbPass
- the application password credentials authenticate on push for RIM devicesbbPort
- the port of the blackberry push