Chat SDK for Android v1.2.1
agora java chat SDK
Public Member Functions | Static Public Member Functions | List of all members
io.agora.push.PushHelper Class Reference

Public Member Functions

void setPushListener (PushListener callback)
 
void init (Context context, PushConfig config)
 
void register ()
 
boolean unregister (boolean unbindToken)
 
void onReceiveToken (PushType type, final String token)
 
void onErrorResponse (PushType type, long resultCode)
 
PushType getPushType ()
 
String getPushToken ()
 
String getFCMPushToken ()
 
void setFCMPushToken (String token)
 
String getPushTokenWithType (PushType type)
 
void setPushTokenWithType (PushType type, final String token)
 

Static Public Member Functions

static PushHelper getInstance ()
 

Detailed Description

The push help class.

Member Function Documentation

◆ getFCMPushToken()

String io.agora.push.PushHelper.getFCMPushToken ( )

Gets the FCM's push token.

Returns
The FCM's push token.

◆ getInstance()

static PushHelper io.agora.push.PushHelper.getInstance ( )
static

Gets a singleton of PushHelper.

Returns
The singleton of PushHelper.

◆ getPushToken()

String io.agora.push.PushHelper.getPushToken ( )

Gets the push token.

Returns
The push token.

◆ getPushTokenWithType()

String io.agora.push.PushHelper.getPushTokenWithType ( PushType  type)

Gets the push token with the push type.

Parameters
typeThe push type.
Returns
The push token.

◆ getPushType()

PushType io.agora.push.PushHelper.getPushType ( )

Gets the push type.

Returns
The push type.

◆ init()

void io.agora.push.PushHelper.init ( Context  context,
PushConfig  config 
)

Initializes the PushHelper.

Parameters
contextThe context of Android Activity or Application.
configThe Push configurations.

◆ onErrorResponse()

void io.agora.push.PushHelper.onErrorResponse ( PushType  type,
long  resultCode 
)

Occurs when a push error occurs. The SDK triggers this callback when a push error, such as push token binding failure (PUSH_BIND_FAILED), push token unbinding failure (PUSH_UNBIND_FAILED), or unsupported custom types (PUSH_NOT_SUPPORT), occurs. You can have more detailed information on the error from the returned resultCode. If the customized PushListener is not null, pass error info to PushListener#onError(PushType, long).

Parameters
typeThe push type.
resultCodeThe error code.

◆ onReceiveToken()

void io.agora.push.PushHelper.onReceiveToken ( PushType  type,
final String  token 
)

Receives and uploads the device token。

Parameters
typeThe push type.
tokenThe device token.

◆ register()

void io.agora.push.PushHelper.register ( )

Registers the push service. After successful login, the SDK calls the method instead of you.

◆ setFCMPushToken()

void io.agora.push.PushHelper.setFCMPushToken ( String  token)

Saves the FCM's push token.

Returns
The FCM's push token.

◆ setPushListener()

void io.agora.push.PushHelper.setPushListener ( PushListener  callback)

Sets the push listener. You can override PushListener#isSupportPush(PushType, PushConfig) to set the push types. Supported push types are PushType.FCM,PushType.MIPUSH,PushType.HMSPUSH,PushType.MEIZUPUSH,PushType.OPPOPUSH,PushType.VIVOPUSH. If you set a push type beyond this scope, the SDK will choose the Normal push of the chat service without error information without reporting error information.

Parameters
callbackThe push listener.

◆ setPushTokenWithType()

void io.agora.push.PushHelper.setPushTokenWithType ( PushType  type,
final String  token 
)

Sets the push token with the push type.

Parameters
typeThe push type.
tokenThe push token.

◆ unregister()

boolean io.agora.push.PushHelper.unregister ( boolean  unbindToken)

Unregisters the push service. This method is called by SDK during the call of ChatClient#logout(boolean)}.

Parameters
unbindTokenWhether to unbind the device.
Returns
Whether the unregistering push succeeds.

The documentation for this class was generated from the following file: