Beagle v1.7 is no longer actively maintained. The documented version you are viewing may contain deprecated functionality. For up-to-date documentation, see the latest version .
DeepLinkHandler
is a interface that defines how to configure navigation between a
Server-Driven screen and a native screen.
You have to create a class that implements the DeepLinkHandler
interface and annotates it with @BeagleComponent
, as listed below:
@BeagleComponent
class AppDeepLinkHandler : DeepLinkHandler {
override fun getDeepLinkIntent(
rootView: RootView,
path: String,
data: Map<String, String>?,
shouldResetApplication: Boolean
) = Intent(path)
}
In the getDeepLinkIntent method, you can configure the navigation screens of the server-driven ui flows to their native screens, making sure that Beagle recognizes your rule.
Attribute | Type | Definition |
---|---|---|
rootView | RootView | RootView holds the reference to the activity or fragment |
path | String | Route parameter that can be set by Navigate.OpenNativeRoute(route: “navigate.myview”) |
data | Map<String, String>? | Parameter map that can be defined by OpenNativeRoute(route = “navigate.myview” , data = mapOf(“param1” to “paramValue”)) |
shouldResetApplication | Boolean | Opens a screen with the route informed from a new flow and clears the stack of screens for the entire application. |
Once you made it, it’s necessary modify the Android manifest file:
intent filter
at the activity you wish to navigate to.action tag
that will identify this activity. The id name
you used here is "navigate.myview"
category tag
and name it "android.intent.category.DEFAULT" ,
like the example below://AndroidManifest
<activity android:name=".activities.DeepLinkActivity">
<intent-filter>
<action android:name="navigate.myview"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</activity>
And that’s it. Now you just need to call the Navigate action with the method OpenNativeRoute like the example below:
//Widget used to navigate to a native screen
Button(
text = "Click to navigate!",
onPress = listOf(
Navigate.OpenNativeRoute("navigate.myview")
)
)
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.