Class RongPushClient
- 
                    
                    - All Implemented Interfaces:
 
 public class RongPushClient
- 
                
                    
                    - 
                                
                            
                                Nested Class SummaryNested Classes Modifier and Type Class Description public enumRongPushClient.ConversationTypeConversation Type Enumeration. 
 - 
                                
                            
                                Constructor SummaryConstructors Constructor Description RongPushClient()
 - 
                                
                            
                                Method SummaryModifier and Type Method Description static voidregisterGCM(Context context)Registers for GCM push notifications. static voidregisterFCM(Context context)Registers for FCM push notifications. static voidregisterMiPush(Context context, String miAppId, String miAppKey)Registers Xiaomi Push. static voidregisterHWPush(Context context)Registers for Huawei push notifications. static voidregisterMZPush(Context context, String appId, String appKey)Registers for Meizu push notifications. static voidresolveHWPushError(Activity activity, long errorCode)Note: After upgrading Huawei Push to version 3.0, this interface has been deprecated and calling it has no effect. static voidresolveHMSCoreUpdate(Activity activity)Handles the logic for upgrading the HMS Core version below 3.0, which cannot obtain the token and triggers a pop-up prompt. static voidinit(Context context, String appKey)Initialization. static voidinit(Context context, String appKey, InitOption initOption, boolean isPushEnable)Initialization (call initialization in the main process of the application). static voidsetPushEventListener(PushEventListener listener)Set the push event listener. static PushEventListenergetPushEventListener()Retrieves the push event listener set at the application layer. static voidstopService(Context context)Stops RCpush services. static voidstopRongPushService(Context context)static voidredirected(Context context)Push service redirection. static voidclearAllNotifications(Context context)Clears all notification messages in the notification bar. static PushTypegetCurrentPushType(Context context)Retrieves the currently used push notification type. static voidclearAllPushNotifications(Context context)Clears all push notifications and background message notifications. static voidclearAllPushServiceNotifications(Context context)Clears all push notifications from background push services. static voidclearNotificationById(Context context, int notificationId)Clears the notification bar based on the notification ID. static voidrecordNotificationEvent(String pushId)Records the click event of a push notification when using the backend push feature in the Developer Console. static voidrecordNotificationEvent(PushNotificationMessage pushNotificationMessage, PushType pushType)Uploads the click event of a push notification. static voidrecordHWNotificationEvent(Intent intent)Tracks Huawei push click events. static voidstopRongPush(Context context)Stops the RCpush notification service. static voidsendNotification(Context context, PushNotificationMessage notificationMessage)Sends a notification. static voidsendNotification(Context context, PushNotificationMessage notificationMessage, int left)Sends a notification. static voidsetNotifiationSound(Uri uri)Sets the notification ringtone URI, which must be an absolute path. static voidcheckManifest(Context context)Helper method to verify whether the RCPush service configuration in the AndroidManifest is correct. static voidcancelPushHeartBeat(Context context)static voidsendPushPing(Context context)static voidupdatePushContentShowStatus(Context context, boolean isShow)static voidrecordPushArriveEvent(Context context, PushType pushType, PushNotificationMessage pushNotificationMessage)Upload push delivery event The push delivery rate in the developer console is calculated based on this event uploaded by the client. static voidsetPushConfig(PushConfig config)Configures push-related settings. - 
                    
                    
                    - 
                                
                            
                                Method Detail- 
                                        registerGCM@Deprecated() static void registerGCM(Context context) Registers for GCM push notifications. Must be called before init(). This method is deprecated. Please use setPushConfig instead. - Parameters:
- context- The context.
 
 - 
                                        registerFCM@Deprecated() static void registerFCM(Context context) Registers for FCM push notifications. Must be called before init(). This method is deprecated. Please use setPushConfig instead. 
 - 
                                        registerMiPush@Deprecated() static void registerMiPush(Context context, String miAppId, String miAppKey) Registers Xiaomi Push. Must be called before init(). This method is deprecated. Please use setPushConfig. - Parameters:
- context- The context.
- miAppId- The AppId of your application registered on the Xiaomi Developer Platform.
- miAppKey- The AppKey of your application registered on the Xiaomi Developer Platform.
 
 - 
                                        registerHWPush@Deprecated() static void registerHWPush(Context context) Registers for Huawei push notifications. Must be called before init(). This method is deprecated. Please use setPushConfig instead. - Parameters:
- context- The context.
 
 - 
                                        registerMZPush@Deprecated() static void registerMZPush(Context context, String appId, String appKey) Registers for Meizu push notifications. Must be called before init(). This method is deprecated. Please use setPushConfig. - Parameters:
- context- The context.
- appId- The Meizu appId generated after registering the application on the Meizu backend.
- appKey- The Meizu appKey generated after registering the application on the Meizu backend.
 
 - 
                                        resolveHWPushError@Deprecated() static void resolveHWPushError(Activity activity, long errorCode) Note: After upgrading Huawei Push to version 3.0, this interface has been deprecated and calling it has no effect. Handle Huawei Push connection errors by end-user operations. Only the following error codes can be resolved by end-user operations: * SERVICE_MISSING* com.huawei.hms.api.ConnectionResult#SERVICE_VERSION_UPDATE_REQUIRED* com.huawei.hms.api.ConnectionResult#BINDFAIL_RESOLUTION_REQUIRED * - Parameters:
- activity- The activity of the current interface, cannot be null
- errorCode- The error code
 
 - 
                                        resolveHMSCoreUpdatestatic void resolveHMSCoreUpdate(Activity activity) Handles the logic for upgrading the HMS Core version below 3.0, which cannot obtain the token and triggers a pop-up prompt. - Parameters:
- activity- The current activity of the interface, which cannot be null
 
 - 
                                        initstatic void init(Context context, String appKey) Initialization. - Parameters:
- context- The context.
- appKey- The unique key for the app.
 
 - 
                                        initstatic void init(Context context, String appKey, InitOption initOption, boolean isPushEnable) Initialization (call initialization in the main process of the application). Use this interface when users set their own push server address. - Parameters:
- context- The context.
- appKey- The unique key of the app.
 
 - 
                                        setPushEventListenerstatic void setPushEventListener(PushEventListener listener) Set the push event listener. All third-party push-related events can be intercepted through this listener. RongCloud's default push notifications, which require cross-process communication, still need to be monitored via io.rong.push.notification.PushMessageReceiver. - Parameters:
- listener- The push event listener
 
 - 
                                        getPushEventListenerstatic PushEventListener getPushEventListener() Retrieves the push event listener set at the application layer. - Returns:
- The push event listener 
 
 - 
                                        stopServicestatic void stopService(Context context) Stops RCpush services. If a third-party push service is in use, the connection to the third-party push service will also be terminated. - Parameters:
- context- The application context
 
 - 
                                        stopRongPushServicestatic void stopRongPushService(Context context) 
 - 
                                        redirectedstatic void redirected(Context context) Push service redirection. This interface allows re-accessing the push navigation server and establishing a connection based on the returned address. - Parameters:
- context- Application context
 
 - 
                                        clearAllNotificationsstatic void clearAllNotifications(Context context) Clears all notification messages in the notification bar. - Parameters:
- context- The context
 
 - 
                                        getCurrentPushTypestatic PushType getCurrentPushType(Context context) Retrieves the currently used push notification type. If the configuration fails, the returned push type is UNKNOWN. 
 - 
                                        clearAllPushNotificationsstatic void clearAllPushNotifications(Context context) Clears all push notifications and background message notifications. For example: If Account A is offline or moved to the background, and Account B sends a message to Account A, Account A's device will receive a notification for this message. Calling this function will clear such notifications. However, push notifications sent via the broadcast push service from the developer backend will remain and will not be cleared. - Parameters:
- context- The context.
 
 - 
                                        clearAllPushServiceNotificationsstatic void clearAllPushServiceNotifications(Context context) Clears all push notifications from background push services. Background push services refer to broadcast push services from the developer's backend. - Parameters:
- context- The context.
 
 - 
                                        clearNotificationByIdstatic void clearNotificationById(Context context, int notificationId) Clears the notification bar based on the notification ID. - Parameters:
- context- The context.
- notificationId- The ID of the notification message.
 
 - 
                                        recordNotificationEvent@Deprecated() static void recordNotificationEvent(String pushId) Records the click event of a push notification when using the backend push feature in the Developer Console. The push open rate in the Developer Console is calculated based on this event uploaded by the client. * For versions prior to 2.6.0, please search for the tag push in the knowledge base for related instructions on using the push open rate. * For versions after 2.6.0, if the user is using the SDK's built-in notification implementation, there is no need to call this method to track the push open rate, as the SDK handles the statistics internally. * However, if the user has customized the display of the notification bar for push notifications, this method must be called when the notification is clicked to upload the push open event to the server. - Parameters:
- pushId- The ID of the push notification.
 
 - 
                                        recordNotificationEventstatic void recordNotificationEvent(PushNotificationMessage pushNotificationMessage, PushType pushType) Uploads the click event of a push notification. The open rate of push notifications in the developer backend is calculated based on this event uploaded by the client. - Parameters:
- pushNotificationMessage- The push notification message
- pushType- The type of push notification
 
 - 
                                        recordHWNotificationEventstatic void recordHWNotificationEvent(Intent intent) Tracks Huawei push click events. If the user has not customized the intent in the developer console, this interface needs to be called in the `onCreate` method of the activity configured for the conversation list UI. Example: if(intent != null && intent.getData() != null && intent.getData().getScheme() != null && intent.getData().getScheme().equals(rong) && intent.getData().getQueryParameter(isFromPush) != null && intent.getData().getQueryParameter(isFromPush).equals(true)){ RongPushClient.recordHWNotificationEvent(intent); }If the user has customized the intent for Huawei push clicks in the developer console, the intent needs to be filtered in the configured activity based on the custom intent, and then this interface should be called. - Parameters:
- intent- The intent passed from the Huawei push click.
 
 - 
                                        stopRongPush@Deprecated() static void stopRongPush(Context context) Stops the RCpush notification service. - Parameters:
- context- The context.
 
 - 
                                        sendNotificationstatic void sendNotification(Context context, PushNotificationMessage notificationMessage) Sends a notification. If using IMLib for development, when the application is in the background and needs to display a notification, this function can be directly called to show the notification. - Parameters:
- context- The context.
- notificationMessage- The notification message exposed by RongCloud.
 
 - 
                                        sendNotificationstatic void sendNotification(Context context, PushNotificationMessage notificationMessage, int left) Sends a notification. If developing with IMLib, when the app is in the background and requires a background notification, this function can be directly called to display the notification. - Parameters:
- context- The context.
- notificationMessage- The notification message exposed by RongCloud.
- left- The count of offline messages.
 
 - 
                                        setNotifiationSoundstatic void setNotifiationSound(Uri uri) Sets the notification ringtone URI, which must be an absolute path. Calling this method after init but before connect ensures that all received messages after connection will use this ringtone. - Parameters:
- uri- The ringtone URI
 
 - 
                                        checkManifest@Deprecated() static void checkManifest(Context context) Helper method to verify whether the RCPush service configuration in the AndroidManifest is correct. - Parameters:
- context- The context.
 
 - 
                                        cancelPushHeartBeatstatic void cancelPushHeartBeat(Context context) 
 - 
                                        sendPushPingstatic void sendPushPing(Context context) 
 - 
                                        updatePushContentShowStatusstatic void updatePushContentShowStatus(Context context, boolean isShow) 
 - 
                                        recordPushArriveEventstatic void recordPushArriveEvent(Context context, PushType pushType, PushNotificationMessage pushNotificationMessage) Upload push delivery event The push delivery rate in the developer console is calculated based on this event uploaded by the client. - Parameters:
- context- The context
- pushType- The push type PushType
- pushNotificationMessage- The push notification message PushNotificationMessage
 
 - 
                                        setPushConfigstatic void setPushConfig(PushConfig config) Configures push-related settings. Must be called before initializing the SDK. - Parameters:
- config- Push configuration.
 
 
- 
                                        
 
- 
                                
                            
                                
 
- 
                    
                    
                    
 
-