ICHMSPushProvider

getPushToken

This method is called to gets the current device push token.

  Syntax: public static String getPushToken()

String pushToken = ICHMSPushProvider.getPushToken();

processPushToken

This method is called to handle new push registration token.

Syntax: public static void processPushToken() throws ICException

Throws an ICException if a user is not registered with Webex Connect or if Push feature is not enabled.

Parameters:

Parameter

Type

Description

RemoteMessage

com.huawei.hms.push.RemoteMessage

A remote HMS Message

try {  
   ICHMSPushProvider.processPushToken();  
}  
catch (ICException e) {  
   Log.e("processPushToken", exception.getLocalizedMessage(), exception);  
}

📘

Note:

This method call required only if application developer implements their own HmsMessageService and requires to receive push messages from connect platform.

processPushMessage (Deprecated)

This method is called to handle push messages received from Webex Connect platform.

Syntax: public void processPushMessage(RemoteMessage message) throws ICException

Throws an ICException if a user is not registered with Webex Connect or if Push feature is not enabled or if message is not from Webex Connect platform.

try {  
   ICHMSPushProvider.processPushMessage(remoteMessage);  
} catch (ICException exception) {  
   Log.e("processPushMessage ", exception.getLocalizedMessage(), exception);  
}

📘

Note:

This method call required only if application developer implements their own FirebaseMessagingService and requires connect SDK to process the push message received from connect platform.

processPushData

This method is called to handle push message received from connect platform.

Syntax:  void processPushData(Map<String,String> data) throws ICException

Parameters: 

Parameter

Type

Description

data

Map<String,String>

The message data map.

📘

Note

This method call required only if application developer implements their own HmsMessageService
and requires connect SDK to process the push message received from connect platform.

try 
{ 
   ICHMSPushProvider.processPushData(remoteMessage.getDataOfMap()); 
} 
catch (ICException exception) 
{ 
     Log.e("processPushData", exception.getLocalizedMessage(), exception); 
}

isConnnectPushMessage (Deprecated)

This helper method returns whether the message is from the Webex Connect platform or not.

Syntax: public boolean isConnnectPushMessage(RemoteMessage message)

Return Value:  Returns true if the message is from connect platform false otherwise.

isConnectPushData

This helper method returns whether the message is from the Webex Connect platform or not.

Syntax:  void isConnectPushData(Map<String,String> data)

Parameters:

Parameter

Type

Description

data

Map<String,String>

The message data map.

Returns: Returns true if the message is from connect platform false otherwise.

addPushTokenListener

This method is allows to add an object which implements the ICPushTokenListener interface to listen for updated token.

  Syntax: public static void addPushTokenListener(final ICPushTokenListener listener)

  Parameters:

Parameter

Type

Description

listener

ICPushTokenListener

Push token listener

ICHMSPushProvider.addPushTokenListener(new ICPushTokenListener()  
{  
   @Override  
   public void onNewPushToken(final String pushToken)  
   {  
      Log.d(TAG, "onNewPushToken(): " + pushToken);  
   }  
});

removePushTokenListener

This method is allows the developer to remove a previously added object which implements the ICPushTokenListener interface, in order to stop listening for updated token.

Syntax: public static void removePushTokenListener(final ICPushTokenListener listener)

Parameters:

Parameter

Type

Description

listener

ICPushTokenListener

Push token listener