tryUseDefaultDistributor

fun tryUseDefaultDistributor(activity: Activity, callback: (Boolean) -> Unit)

Try to use the distributor opening the deeplink "unifiedpush://link"

It allows users to define a default distributor for all their applications

Before calling this function, you may want to resolve the default distributor with resolveDefaultDistributor, to check if the OS will show a screen to the user. In this case, you can introduce this screen with a dialog "You are about to select your push service"

External distributors will be favored over embedded distributors.

This function starts a new translucent activity in order to get the result of the distributor activity.

You may prefer to override onActivityResult of your own Activity and use LinkActivityHelper.startLinkActivityForResult instead.

Usage

Kotlin:

tryUseDefaultDistributor(activityContext) { success ->
if (success) {
//TODO: register, no need to saveDistributor
}
}

Java:

UnifiedPush.tryUseDefaultDistributor(activityContext, success -> {
if (success) {
//TODO: register, no need to saveDistributor
}
return null;
});

Parameters

activity

Activity Context

callback

is a function taking a Boolean as parameter. This boolean is true if the registration using the deeplink succeeded.