use of com.amazonaws.mobileconnectors.pinpoint.PinpointConfiguration in project zype-android by zype.
the class ZypeApp method getPinpointManager.
public static PinpointManager getPinpointManager(Context context) {
if (pinpointManager == null || TextUtils.isEmpty(pinpointManager.getNotificationClient().getDeviceToken())) {
PinpointConfiguration pinpointConfig = new PinpointConfiguration(context.getApplicationContext(), AWSMobileClient.getInstance().getCredentialsProvider(), AWSMobileClient.getInstance().getConfiguration());
pinpointManager = new PinpointManager(pinpointConfig);
FirebaseInstanceId.getInstance().getInstanceId().addOnCompleteListener(new OnCompleteListener<InstanceIdResult>() {
@Override
public void onComplete(@NonNull Task<InstanceIdResult> task) {
if (task.isSuccessful()) {
final String token = task.getResult().getToken();
Logger.d("Registering push notifications token: " + token);
pinpointManager.getNotificationClient().registerDeviceToken(token);
} else {
Logger.e("onComplete(): Failed: " + task.getException().getMessage());
}
}
});
}
return pinpointManager;
}
Aggregations