(OLD, v1.0.0.47) Editing SDK methods - GlobalMessageServices/BCS-GMS-SDK-Android GitHub Wiki

THE PAGE IS UNDER DEVELOPMENT, INFORMATION MAY NOT BE EXHAUSTIVE, ACTUAL INFORMATION MAY DIFFER

PushSDK class

Main class, used for initialization

class PushSDK(
    context: Context,
    platform_branch: UrlsPlatformList = PushSdkParametersPublic.branchMasterValue,
    log_level: String = "error",
    basePushURL: String
){
...
}

Params:

  • context - the context you would like to use
  • platform_branch -
  • log_level -
  • basePushURL - base URL path to the API

Usage example:

val pushSDK = PushSDK(
    context = this,
    basePushURL = "https://yourapilink.com/version/"
)

Callbacks

Each method would return an answer upon finishing execution

The answer structure is as follows:

  • Answer structure returned by registration methods:
public data class PushKFunAnswerRegister(
    val code: Int,
    val result: String,
    val description: String,
    val deviceId: String,
    val token: String,
    val userId: String,
    val userPhone: String,
    val createdAt: String
)
  • Answer structure returned by other methods:
public data class PushKFunAnswerGeneral(
    val code: Int,
    val result: String,
    val description: String,
    val body: String
)

push_register_new

Register the device

Params:

  • X_Push_Client_API_Key - API key that you would be provided with
  • X_Push_App_Fingerprint - APP fingerprint that you would be provided with
  • user_msisdn - Device's phone number
  • user_password - password, associated with Device's phone number
  • X_FCM_token - your firebase cloud messaging token

Usage examples:

pushSDK.push_register_new(
    "Client_API_Key",  //API key that you would be provided with
    "App_Fingerprint", //APP fingerprint that you would be provided with
    "88002000600", //Device's phone number
    "UserPassword" //password, associated with Device's phone number
)
pushSDK.push_register_new(
    "Client_API_Key",  //API key that you would be provided with
    "App_Fingerprint", //APP fingerprint that you would be provided with
    "UserMsisdn", //Device's phone number
    "UserPassword", //password, associated with Device's phone number
    "FCM token" //your firebase cloud messaging token
)

push_update_registration

Update registration

Params:

Usage example:

pushSDK.push_update_registration()

push_clear_current_device

Unregister the current device from database (if registered)

Params:

Usage example:

pushSDK.push_clear_current_device()

push_clear_all_device

Unregister all devices registered with the current phone number from database

Params:

Usage example:

pushSDK.push_clear_all_device()

push_get_device_all_from_server

Get a list of all devices registered with the current phone number

Params:

Usage example:

pushSDK.push_get_device_all_from_server()

push_get_message_history

Get message history

Params:

  • period - amount of time to get message history for

Usage example:

pushSDK.push_get_message_history(3600)

push_check_queue

Checks undelivered message queue and sends delivery report for the messages

Params:

Usage example:

pushSDK.push_check_queue()

push_send_message_callback

Send a message to the server and receive a callback

Params:

  • message_id - id of the message
  • message_text - text of the message

Usage example:

pushSDK.push_send_message_callback("message_id", "message_text")

push_message_delivery_report

Send a delivery report for a specific message

Params:

  • message_id - message id to get the delivery report for

Usage example:

pushSDK.push_message_delivery_report("message_id")

rewrite_msisdn

Change phone number

Params:

  • newmsisdn - new phone number

Usage example:

pushSDK.rewrite_msisdn(88002000600)

rewrite_password

Change password

Params:

  • newPassword - new password

Usage example:

pushSDK.rewrite_password(newpassword)