hyphenate_SDK4.0 4.8.0
hyphenate java IM SDK
Public Member Functions | Static Public Member Functions | List of all members
com.hyphenate.push.EMPushHelper Class Reference

Public Member Functions

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

Static Public Member Functions

static EMPushHelper getInstance ()
 

Detailed Description

The push help class.

Member Function Documentation

◆ getFCMPushToken()

String com.hyphenate.push.EMPushHelper.getFCMPushToken ( )

Gets the FCM's push token.

Returns
The FCM's push token.

◆ getInstance()

static EMPushHelper com.hyphenate.push.EMPushHelper.getInstance ( )
static

Gets a singleton of EMPushHelper.

Returns
The singleton of EMPushHelper.

◆ getPushToken()

String com.hyphenate.push.EMPushHelper.getPushToken ( )

Gets the push token.

Returns
The push token.

◆ getPushTokenWithType()

String com.hyphenate.push.EMPushHelper.getPushTokenWithType ( EMPushType  type)

Gets the push token with the push type.

Parameters
typeThe push type.
Returns
The push token.

◆ getPushType()

EMPushType com.hyphenate.push.EMPushHelper.getPushType ( )

Gets the push type.

Returns
The push type.

◆ init()

void com.hyphenate.push.EMPushHelper.init ( Context  context,
EMPushConfig  config 
)

Initializes the EMPushHelper.

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

◆ onErrorResponse()

void com.hyphenate.push.EMPushHelper.onErrorResponse ( EMPushType  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(EMPushType, long).

Parameters
typeThe push type.
resultCodeThe error code.

◆ onReceiveToken()

void com.hyphenate.push.EMPushHelper.onReceiveToken ( EMPushType  type,
final String  token 
)

Receives and uploads the device token。

Parameters
typeThe push type.
tokenThe device token.

◆ register()

void com.hyphenate.push.EMPushHelper.register ( )

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

◆ setFCMPushToken()

void com.hyphenate.push.EMPushHelper.setFCMPushToken ( String  token)

Saves the FCM's push token.

Returns
The FCM's push token.

◆ setPushListener()

void com.hyphenate.push.EMPushHelper.setPushListener ( PushListener  callback)

Sets the push listener. You can override PushListener#isSupportPush(EMPushType, EMPushConfig) to set the push types. Supported push types are EMPushType.FCM,EMPushType.MIPUSH,EMPushType.HMSPUSH,EMPushType.MEIZUPUSH,EMPushType.OPPOPUSH,EMPushType.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 com.hyphenate.push.EMPushHelper.setPushTokenWithType ( EMPushType  type,
final String  token 
)

Sets the push token with the push type.

Parameters
typeThe push type.
tokenThe push token.

◆ unregister()

boolean com.hyphenate.push.EMPushHelper.unregister ( boolean  unbindToken)

Unregisters the push service. This method is called by SDK during the call of EMClient#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: