Deep Linking in Android

This document describes how to handling deep links with push notifications. For information on deep linking with In-App, see Inbox and In-App Action Handling for Android (Mapp Cloud)

Currently, our SDK does not support custom URI deep links. The SDK currently requires a standardized URI to encode the deep link. When enabling deep linking within the mobile app, include the configuration for the project manifest and java function. When the marketer specifies which deep link to use in Mapp Engage, they need to include the syntax APX://open=deeplink

Deeplink:

The configuration of the project manifest.

<activity android:name=".DeepLinkActivity"> <intent-filter> <data android:scheme="apx"/> <data android:host="deeplink"/> <action android:name="com.appoxee.VIEW_DEEPLINK"/> <category android:name="android.intent.category.DEFAULT"/> <category android:name="android.intent.category.BROWSABLE"/> <category android:name="${applicationId}" /> //mandatory for Android FCM SDK v6.0.9 and later </intent-filter> </activity>

The current version of deep linking for push notifications, requires the developer to anticipate where a deep link will be received in the app. 

On each app page where a deep link is expected, call the following Java function. If you don't use specific launch mode for activity, the following snippet you should call in onCreate() method or if you use specific launch mode you should call in onNewIntent() method. 

Uri uri; if (getIntent() != null) { if ("com.appoxee.VIEW_DEEPLINK".equals(getIntent().getAction())) { uri = getIntent().getData(); //Data supplied from the front-end. String link = uri.getQueryParameter("link"); //This is the messageId String messageId = uri.getQueryParameter("message_id"); //This is the eventTrigger only for version 5.0.7 and higher String eventTrigger = uri.getQueryParameter("event_trigger"); Intent i = new Intent(Intent.ACTION_VIEW); i.setData(Uri.parse(link)); startActivity(i); } }

 

Example for Compose application with ComponentActivity, how can handle DEEPLINK from push message.

class DeepLinkActivity : ComponentActivity() { private val APX_LAUNCH_DEEPLINK_ACTION = "com.appoxee.VIEW_DEEPLINK" override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContent { val data = remember { mutableStateListOf<String>("Test data") } Body(data = data) LaunchedEffect(key1 = Unit) { if (APX_LAUNCH_DEEPLINK_ACTION == intent.action) { intent.data?.let { data.clear() val link = it.getQueryParameter("link") ?: "" val messageId: String = it.getQueryParameter("message_id") ?: "" val eventTrigger: String = it.getQueryParameter("event_trigger") ?: "" data.add(link) data.add(messageId) data.add(eventTrigger) } } } } } } @OptIn(ExperimentalMaterial3Api::class) @Composable fun Body(data: List<String>) { TestCoopTheme() { Surface( modifier = Modifier .fillMaxSize() ) { LazyColumn( modifier = Modifier .fillMaxSize() .padding(10.dp), ) { items(data) { Text(it) } } } } }

The marketer can use the Deep Link parameter in Mapp Engage when defining the Push Notification to enter the URI of the app page.