Search in sources :

Example 1 with PinpointConfiguration

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;
}
Also used : PinpointConfiguration(com.amazonaws.mobileconnectors.pinpoint.PinpointConfiguration) PinpointManager(com.amazonaws.mobileconnectors.pinpoint.PinpointManager) InstanceIdResult(com.google.firebase.iid.InstanceIdResult)

Aggregations

PinpointConfiguration (com.amazonaws.mobileconnectors.pinpoint.PinpointConfiguration)1 PinpointManager (com.amazonaws.mobileconnectors.pinpoint.PinpointManager)1 InstanceIdResult (com.google.firebase.iid.InstanceIdResult)1