Interface PushEventListener
-
- All Implemented Interfaces:
public interface PushEventListener
-
-
Method Summary
Modifier and Type Method Description abstract boolean
preNotificationMessageArrived(Context context, PushType pushType, PushNotificationMessage notificationMessage)
Callback before the notification is displayed. abstract void
afterNotificationMessageArrived(Context context, PushType pushType, PushNotificationMessage notificationMessage)
Callback triggered when a push notification delivery event is received from a third-party push platform. abstract boolean
onNotificationMessageClicked(Context context, PushType pushType, PushNotificationMessage notificationMessage)
Callback triggered when a notification is clicked. abstract void
onThirdPartyPushState(PushType pushType, String action, long resultCode)
Third-party push notification status callback abstract void
onTokenReceived(PushType pushType, String token)
Received Push Token Callback abstract void
onTokenReportResult(PushType reportType, int code, PushType finalType, String finalToken)
Token Reporting Callback void
onTokenReportResult(PushType reportType, int code, PushType finalType, String finalToken, String message, Map<String, String> failMap)
Token report callback void
onTokenReportResult(PushType reportType, int code, PushType finalType, String finalToken, String message)
Token Reporting Callback void
onStartRegister(List<PushType> preferTypes)
Starts push notification registration void
onPreferPushType(List<PushType> preferType)
Callback for obtaining the most suitable push notification type void
onGetTokenServer(boolean isSuccess)
Callback for obtaining the push token reporting server address void
onPushConfigInitFinish(Builder pushConfig)
Push configuration parsed when using the Push 2.0 plugin. void
onGetTokenError(PushType pushType, long code, String errorMessage)
Callback for failed token retrieval List<TokenBean>
onStartTokenReport(List<TokenBean> tokenList)
This method is called when the SDK is about to report the push token. -
-
Method Detail
-
preNotificationMessageArrived
abstract boolean preNotificationMessageArrived(Context context, PushType pushType, PushNotificationMessage notificationMessage)
Callback before the notification is displayed. Users can intercept this event to customize the notification display. This method is called back for RCdefault push, Huawei data transmission push, and FCM data push.
- Parameters:
context
- The contextpushType
- The push typenotificationMessage
- The push message- Returns:
Whether to intercept the event. `true` means the event is intercepted and the SDK will not handle it; `false` means the SDK will handle it with default logic.
-
afterNotificationMessageArrived
abstract void afterNotificationMessageArrived(Context context, PushType pushType, PushNotificationMessage notificationMessage)
Callback triggered when a push notification delivery event is received from a third-party push platform. At this point, the notification has already been displayed by the mobile platform and cannot be customized.
- Parameters:
context
- The contextpushType
- The type of push notificationnotificationMessage
- The push notification message
-
onNotificationMessageClicked
abstract boolean onNotificationMessageClicked(Context context, PushType pushType, PushNotificationMessage notificationMessage)
Callback triggered when a notification is clicked.
- Parameters:
context
- The contextpushType
- The type of push notificationnotificationMessage
- The push notification message- Returns:
Indicates whether the event is intercepted. true means the event is intercepted by the application layer, and the SDK will not process it; false means the event is processed according to the SDK's default logic.
-
onThirdPartyPushState
abstract void onThirdPartyPushState(PushType pushType, String action, long resultCode)
Third-party push notification status callback
- Parameters:
pushType
- Push notification typeaction
- EventresultCode
- Error code
-
onTokenReceived
abstract void onTokenReceived(PushType pushType, String token)
Received Push Token Callback
- Parameters:
pushType
- Push notification typetoken
- The received PushToken
-
onTokenReportResult
abstract void onTokenReportResult(PushType reportType, int code, PushType finalType, String finalToken)
Token Reporting Callback
- Parameters:
reportType
- Specifies the reporting typecode
- Indicates the server response codefinalType
- Represents the final negotiation resultfinalToken
- Specifies the final negotiated token
-
onTokenReportResult
void onTokenReportResult(PushType reportType, int code, PushType finalType, String finalToken, String message, Map<String, String> failMap)
Token report callback
- Parameters:
reportType
- Report typecode
- Server response codefinalType
- Final negotiation resultfinalToken
- Final negotiated tokenmessage
- Server response messagefailMap
- Server response: types of push that ultimately failed
-
onTokenReportResult
void onTokenReportResult(PushType reportType, int code, PushType finalType, String finalToken, String message)
Token Reporting Callback
- Parameters:
reportType
- Specifies the type of reportcode
- Indicates the code returned by the serverfinalType
- Represents the final negotiation resultfinalToken
- Specifies the final negotiated tokenmessage
- Indicates the message returned by the server
-
onStartRegister
void onStartRegister(List<PushType> preferTypes)
Starts push notification registration
- Parameters:
preferTypes
- Specifies the types of push notifications to register
-
onPreferPushType
void onPreferPushType(List<PushType> preferType)
Callback for obtaining the most suitable push notification type
- Parameters:
preferType
- The most suitable push notification type
-
onGetTokenServer
void onGetTokenServer(boolean isSuccess)
Callback for obtaining the push token reporting server address
- Parameters:
isSuccess
- Indicates whether the operation was successful
-
onPushConfigInitFinish
void onPushConfigInitFinish(Builder pushConfig)
Push configuration parsed when using the Push 2.0 plugin. Modify here if needed.
- Parameters:
pushConfig
- Push configuration
-
onGetTokenError
void onGetTokenError(PushType pushType, long code, String errorMessage)
Callback for failed token retrieval
- Parameters:
pushType
- Push notification typecode
- Error codeerrorMessage
- Error message
-
onStartTokenReport
List<TokenBean> onStartTokenReport(List<TokenBean> tokenList)
This method is called when the SDK is about to report the push token. Users can use this interface to adjust the order of push registration. The SDK will report based on the adjusted order.
- Parameters:
tokenList
- The default reporting order of the SDK, with higher priority tokens registered first.- Returns:
Returns the priority order.
-
-
-
-