Package com.sinch.android.rtc
Class SinchHelpers
- java.lang.Object
-
- com.sinch.android.rtc.SinchHelpers
-
public class SinchHelpers extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description SinchHelpers()
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static boolean
isGooglePlayServicesAvailable(android.content.Context context)
static boolean
isHuaweiMobileServicesAvailable(android.content.Context context)
static boolean
isSinchPushIntent(android.content.Intent intent)
Deprecated.static boolean
isSinchPushPayload(java.util.Map<java.lang.String,java.lang.String> payload)
Inspects theintent
to decide if it might be intended for aSinchClient
.static NotificationResult
queryPushNotificationPayload(android.content.Context context, java.util.Map<java.lang.String,java.lang.String> payload)
Method used to parse push payload and retrieve partially validated NotificationResult mainly to provide a way to check custom public headers that came with push message before deciding how to process the message and whether to start Sinch client at all.
-
-
-
Method Detail
-
isSinchPushIntent
@Deprecated public static boolean isSinchPushIntent(android.content.Intent intent)
Deprecated.Inspects theintent
to decide if it might be intended for aSinchClient
.- Parameters:
intent
- Intent received from a FCM receiver- Returns:
- true if the Intent includes Sinch extras, otherwise false
-
isSinchPushPayload
public static boolean isSinchPushPayload(java.util.Map<java.lang.String,java.lang.String> payload)
Inspects theintent
to decide if it might be intended for aSinchClient
.- Parameters:
payload
- Data received with a FCM RemoteMessage- Returns:
- true if the payload includes Sinch data, otherwise false
-
queryPushNotificationPayload
public static NotificationResult queryPushNotificationPayload(android.content.Context context, java.util.Map<java.lang.String,java.lang.String> payload)
Method used to parse push payload and retrieve partially validated NotificationResult mainly to provide a way to check custom public headers that came with push message before deciding how to process the message and whether to start Sinch client at all. IMPORTANT: validity check of the NotificatrionResult is limited, because Sinch client is not started. The method is NOT lightweight alternative ofSinchClient.relayRemotePushNotificationPayload(java.lang.String)
, but a HELPER method with limited functionality.Intended use in FCM listener service:
public void onMessageReceived(RemoteMessage remoteMessage){ Map data = remoteMessage.getData(); if (SinchHelpers.isSinchPushPayload(data)) {
Map<String,String>
headers = SinchHelpers.queryPushNotificationPayload(context, data).getCallResult().getHeaders(); ... } ...- Parameters:
context
- Application context to load native libraries used for payload parsing.payload
- Payload received from a FCM RemoteMessage data- Returns:
- A result indicating initial inspection of the payload.
- See Also:
isSinchPushPayload(java.util.Map)
,NotificationResult.getCallResult()
,CallNotificationResult.getHeaders()
-
isGooglePlayServicesAvailable
public static boolean isGooglePlayServicesAvailable(android.content.Context context)
-
isHuaweiMobileServicesAvailable
public static boolean isHuaweiMobileServicesAvailable(android.content.Context context)
-
-