Class Push
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringKey for the hashtable argument when pushing to the google play store -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionSets authentication for APNS (iOS)Sets authentication for GMS (Android and Chrome)static StringReturns the push device key if the device was previously successfully registered for push otherwise returns nullstatic StringReturns the push device key if the device was previously successfully registered for push otherwise returns nullpushType(int pushType) Sets the type of push to use.booleansend()Sends push message.voidSends push message asynchronously.static booleansendPushMessage(String body, String deviceKey, boolean production, String googleAuthKey, String iosCertificateURL, String iosCertificatePassword) Sends a push message and returns true if server delivery succeeded, notice that the push message isn't guaranteed to reach all devices.static booleansendPushMessage(String token, String body, boolean production, String googleAuthKey, String iosCertificateURL, String iosCertificatePassword, int pushType, String... deviceKey) Sends a push message and returns true if server delivery succeeded, notice that the push message isn't guaranteed to reach all devices.static booleansendPushMessage(String body, String deviceKey, boolean production, String googleAuthKey, String iosCertificateURL, String iosCertificatePassword, String bbUrl, String bbApp, String bbPass, String bbPort) Sends a push message and returns true if server delivery succeeded, notice that the push message isn't guaranteed to reach all devices.static booleansendPushMessage(String token, String body, String deviceKey, boolean production, String googleAuthKey, String iosCertificateURL, String iosCertificatePassword) Sends a push message and returns true if server delivery succeeded, notice that the push message isn't guaranteed to reach all devices.static booleansendPushMessage(String token, String body, String deviceKey, boolean production, String googleAuthKey, String iosCertificateURL, String iosCertificatePassword, String bbUrl, String bbApp, String bbPass, String bbPort) Sends a push message and returns true if server delivery succeeded, notice that the push message isn't guaranteed to reach all devices.static voidsendPushMessageAsync(String body, String deviceKey, boolean production, String googleAuthKey, String iosCertificateURL, String iosCertificatePassword) Sends a push message and returns true if server delivery succeeded, notice that the push message isn't guaranteed to reach all devices.static voidsendPushMessageAsync(String body, String deviceKey, boolean production, String googleAuthKey, String iosCertificateURL, String iosCertificatePassword, String bbUrl, String bbApp, String bbPass, String bbPort) Sends a push message and returns true if server delivery succeeded, notice that the push message isn't guaranteed to reach all devices.static voidsendPushMessageAsync(String token, String body, String deviceKey, boolean production, String googleAuthKey, String iosCertificateURL, String iosCertificatePassword) Sends a push message and returns true if server delivery succeeded, notice that the push message isn't guaranteed to reach all devices.static voidsendPushMessageAsync(String token, String body, String deviceKey, boolean production, String googleAuthKey, String iosCertificateURL, String iosCertificatePassword, String bbUrl, String bbApp, String bbPass, String bbPort) Sends a push message and returns true if server delivery succeeded, notice that the push message isn't guaranteed to reach all devices.Sets authenticaton for WNS (Windows 10/UWP)
-
Field Details
-
GOOGLE_PUSH_KEY
Key for the hashtable argument when pushing to the google play store- See Also:
-
-
Constructor Details
-
Push
Creates a new push notification.
Parameters
-
token: @param token the authorization token from the account settings in the CodenameOne website, this is used to associate push quotas with your app -
body: the body of the message -
deviceKeys: Device keys when sending to specific devices.
-
-
-
Method Details
-
sendPushMessage
public static boolean sendPushMessage(String body, String deviceKey, boolean production, String googleAuthKey, String iosCertificateURL, String iosCertificatePassword) Sends a push message and returns true if server delivery succeeded, notice that the push message isn't guaranteed to reach all devices.
Parameters
-
body: the body of the message -
deviceKey: an optional parameter (can be null) when sending to a specific device -
production: whether pushing to production or test/sandbox environment -
googleAuthKey: authorization key from the google play store -
iosCertificateURL: a URL where you host the iOS certificate for this applications push capabilities. -
iosCertificatePassword: the password for the push certificate
Returns
- Returns:
true if the message reached the Codename One server successfully, this makes no guarantee of delivery.
Deprecated
-
-
sendPushMessage
public static boolean sendPushMessage(String body, String deviceKey, boolean production, String googleAuthKey, String iosCertificateURL, String iosCertificatePassword, String bbUrl, String bbApp, String bbPass, String bbPort) Sends a push message and returns true if server delivery succeeded, notice that the push message isn't guaranteed to reach all devices.
Parameters
-
body: the body of the message -
deviceKey: an optional parameter (can be null) when sending to a specific device -
production: whether pushing to production or test/sandbox environment -
googleAuthKey: authorization key from the google play store -
iosCertificateURL: a URL where you host the iOS certificate for this applications push capabilities. -
iosCertificatePassword: the password for the push certificate -
bbUrl: @param bbUrl 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.com -
bbApp: the application id to authenticate on push for RIM devices -
bbPass: the application password credentials authenticate on push for RIM devices -
bbPort: the port of the blackberry push
Returns
- Returns:
true if the message reached the Codename One server successfully, this makes no guarantee of delivery.
Deprecated
-
-
sendPushMessageAsync
public static void sendPushMessageAsync(String body, String deviceKey, boolean production, String googleAuthKey, String iosCertificateURL, String iosCertificatePassword) Sends a push message and returns true if server delivery succeeded, notice that the push message isn't guaranteed to reach all devices.
Parameters
-
body: the body of the message -
deviceKey: an optional parameter (can be null) when sending to a specific device -
production: whether pushing to production or test/sandbox environment -
googleAuthKey: authorization key from the google play store -
iosCertificateURL: a URL where you host the iOS certificate for this applications push capabilities. -
iosCertificatePassword: the password for the push certificate
Deprecated
-
-
sendPushMessageAsync
public static void sendPushMessageAsync(String body, String deviceKey, boolean production, String googleAuthKey, String iosCertificateURL, String iosCertificatePassword, String bbUrl, String bbApp, String bbPass, String bbPort) Sends a push message and returns true if server delivery succeeded, notice that the push message isn't guaranteed to reach all devices.
Parameters
-
body: the body of the message -
deviceKey: an optional parameter (can be null) when sending to a specific device -
production: whether pushing to production or test/sandbox environment -
googleAuthKey: authorization key from the google play store -
iosCertificateURL: a URL where you host the iOS certificate for this applications push capabilities. -
iosCertificatePassword: the password for the push certificate -
bbUrl: @param bbUrl 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.com -
bbApp: the application id to authenticate on push for RIM devices -
bbPass: the application password credentials authenticate on push for RIM devices -
bbPort: the port of the blackberry push
Deprecated
-
-
getDeviceKey
Returns the push device key if the device was previously successfully registered for push otherwise returns null
Returns
the device key that can be used to push to this specific device.
Deprecated
-
getPushKey
Returns the push device key if the device was previously successfully registered for push otherwise returns null
Returns
the device key that can be used to push to this specific device.
-
sendPushMessage
public static boolean sendPushMessage(String token, String body, String deviceKey, boolean production, String googleAuthKey, String iosCertificateURL, String iosCertificatePassword) Sends a push message and returns true if server delivery succeeded, notice that the push message isn't guaranteed to reach all devices. This method uses the new push servers
Parameters
-
token: @param token the authorization token from the account settings in the CodenameOne website, this is used to associate push quotas with your app -
body: the body of the message -
deviceKey: the device key that will receive the push message (can't be null!) -
production: whether pushing to production or test/sandbox environment -
googleAuthKey: authorization key from the google play store -
iosCertificateURL: a URL where you host the iOS certificate for this applications push capabilities. -
iosCertificatePassword: the password for the push certificate
Returns
- Returns:
true if the message reached the Codename One server successfully, this makes no guarantee of delivery.
Deprecated
Please use new builder syntax with
#send()which includes parameters for new platforms such as UWP.
-
-
sendPushMessage
public static boolean sendPushMessage(String token, String body, boolean production, String googleAuthKey, String iosCertificateURL, String iosCertificatePassword, int pushType, String... deviceKey) Sends a push message and returns true if server delivery succeeded, notice that the push message isn't guaranteed to reach all devices. This method uses the new push servers
Parameters
-
token: @param token the authorization token from the account settings in the CodenameOne website, this is used to associate push quotas with your app -
body: the body of the message -
production: whether pushing to production or test/sandbox environment -
googleAuthKey: authorization key from the google play store -
iosCertificateURL: a URL where you host the iOS certificate for this applications push capabilities. -
iosCertificatePassword: the password for the push certificate -
pushType: @param pushType the type for the push in the server, this is useful for sending hidden pushes (type 2) should default to 0 or 1 -
deviceKey: set of devices that should receive the push
Returns
- Returns:
true if the message reached the Codename One server successfully, this makes no guarantee of delivery.
Deprecated
Please use new builder syntax with
#send()which includes parameters for new platforms such as UWP.
-
-
sendPushMessage
public 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) Sends a push message and returns true if server delivery succeeded, notice that the push message isn't guaranteed to reach all devices. This method uses the new push servers
Parameters
-
token: @param token the authorization token from the account settings in the CodenameOne website, this is used to associate push quotas with your app -
body: the body of the message -
deviceKey: an optional parameter (can be null) when sending to a specific device -
production: whether pushing to production or test/sandbox environment -
googleAuthKey: authorization key from the google play store -
iosCertificateURL: a URL where you host the iOS certificate for this applications push capabilities. -
iosCertificatePassword: the password for the push certificate -
bbUrl: @param bbUrl 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.com -
bbApp: the application id to authenticate on push for RIM devices -
bbPass: the application password credentials authenticate on push for RIM devices -
bbPort: the port of the blackberry push
Returns
- Returns:
true if the message reached the Codename One server successfully, this makes no guarantee of delivery.
Deprecated
Please use new builder syntax with
#send()which includes parameters for new platforms such as UWP.
-
-
sendPushMessageAsync
public static void sendPushMessageAsync(String token, String body, String deviceKey, boolean production, String googleAuthKey, String iosCertificateURL, String iosCertificatePassword) Sends a push message and returns true if server delivery succeeded, notice that the push message isn't guaranteed to reach all devices. This method uses the new push servers
Parameters
-
token: @param token the authorization token from the account settings in the CodenameOne website, this is used to associate push quotas with your app -
body: the body of the message -
deviceKey: an optional parameter (can be null) when sending to a specific device -
production: whether pushing to production or test/sandbox environment -
googleAuthKey: authorization key from the google play store -
iosCertificateURL: a URL where you host the iOS certificate for this applications push capabilities. -
iosCertificatePassword: the password for the push certificate
Deprecated
Please use new builder syntax with
#sendAsync()which includes parameters for new platforms such as UWP. -
-
sendPushMessageAsync
public 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) Sends a push message and returns true if server delivery succeeded, notice that the push message isn't guaranteed to reach all devices. This method uses the new push servers
Parameters
-
token: @param token the authorization token from the account settings in the CodenameOne website, this is used to associate push quotas with your app -
body: the body of the message -
deviceKey: an optional parameter (can be null) when sending to a specific device -
production: whether pushing to production or test/sandbox environment -
googleAuthKey: authorization key from the google play store -
iosCertificateURL: a URL where you host the iOS certificate for this applications push capabilities. -
iosCertificatePassword: the password for the push certificate -
bbUrl: @param bbUrl 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.com -
bbApp: the application id to authenticate on push for RIM devices -
bbPass: the application password credentials authenticate on push for RIM devices -
bbPort: the port of the blackberry push
Deprecated
Please use new builder syntax with
#sendAsync()which includes parameters for new platforms such as UWP. -
-
gcmAuth
-
apnsAuth
Sets authentication for APNS (iOS)
Parameters
-
iosCertificateURL: a URL where you host the iOS certificate for this applications push capabilities. -
iosCertificatePassword: the password for the push certificate -
production: True if this is a production certificate. False if this is a development certificate.
Returns
Self for chaining
-
-
wnsAuth
-
pushType
Sets the type of push to use. See developer guide for details of different push types. Default is 1
Parameters
pushType
Returns
Self for chaining.
-
send
public boolean send()Sends push message.
Returns
True if the request was successful.
-
sendAsync
public void sendAsync()Sends push message asynchronously.
-