Chat SDK for Android v1.3.1
agora java chat SDK
Public Member Functions | List of all members
io.agora.push.PushListener Class Referenceabstract

Public Member Functions

boolean isSupportPush (PushType pushType, PushConfig pushConfig)
 
String getPushToken (PushType pushType, PushConfig pushConfig)
 

Detailed Description

The push settings class for customized push.

Member Function Documentation

◆ getPushToken()

String io.agora.push.PushListener.getPushToken ( PushType  pushType,
PushConfig  pushConfig 
)

Gets the FCM device token.

Parameters
pushTypeThe push type.
pushConfigThe push configs.
Returns
Returns the device token to register.

◆ isSupportPush()

boolean io.agora.push.PushListener.isSupportPush ( PushType  pushType,
PushConfig  pushConfig 
)

Determines whether a push type is supported. This function will be called multiple times, each time passing a pushType to the user to return a boolean value based on the pushType provided by the SDK, allowing the SDK to determine whether the client environment supports the push type. For example:

  1. If you want to use FCM push, you need to call PushHelper.getInstance().setPushListener() to set the listener and override the isSupportPush function, returning true when the parameter pushType == ChatPushType.FCM.
    PushHelper.getInstance().setPushListener(new PushListener() {
    ……
    @Override
    public boolean isSupportPush(PushType pushType, PushConfig pushConfig) {
    // 由用户实现代码判断设备是否支持FCM推送
    if(pushType == PushType.FCM){
    EMLog.d("FCM", "GooglePlayServiceCode:"+GoogleApiAvailabilityLight.getInstance().isGooglePlayServicesAvailable(context));
    return GoogleApiAvailabilityLight.getInstance().isGooglePlayServicesAvailable(context) == ConnectionResult.SUCCESS;
    }else if (pushType == PushType.HONORPUSH){
    ……
    }
    return super.isSupportPush(pushType, pushConfig);
    }
    });
    boolean isSupportPush(PushType pushType, PushConfig pushConfig)
    Definition: PushListener.java:45
    Similarly, if you return true for a specific pushType (such as HONORPUSH), the SDK will use that type of push, and the function will not be called again. Note: The final success of registration depends on whether the client environment has integrated the relevant push suite.
  2. If you return false for all pushTypes in the isSupportPush callback function, the final push will be through the Huanxin channel.
  3. If this function is not implemented, the SDK will default to determining which push implementation is supported based on the device model.
Parameters
pushTypeThe push type.
pushConfigThe push configurations.
Returns
Returns whether the push type is supported.

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