This section, we will describe the discoveries about deep link on Salesforce In-app Message.
Acceptance criteria:
Verify redirect with dynamic link
Android
We will need to create a Java class to call via React as a lib;
Then, our class will need to extend
Plugin
and implementsMarketingCloudSdk.InitializationListener
, also this class will be assign with:@NativePlugin()
Therefore, we will need to implements three methods, then firsts two methods
load
andcomplete
that will be able empty and will be assign@Override
;The others method we will need to add a some codes:
The first method that will be a main method is:
public void initialize(final PluginCall call)
it’s very important this method be namedinitialize
, 'cause the React will call it. This methods will assign with@PluginMethod()
like this:
Until this moment the call
InAppMessageListener.INSTANCE
no exist, so we will need to create anenum
to satisfy it;Then, will be create a enum
InAppMessageListener
that implementsUrlHandler
We will instance the constant
INSTANCE
;Inside this enum, will create a methods
PendingIntent handleUrl()
that when the user clicked on in-app action button with link, this method will intercept the action and run.So, we need to treat the link to open the app or open the browser, like that:
Lastly, the class need to imported on MainActivity class, like that:
As the react code will call the
initialize
method, the feature will works just on market that the react call run;
...