DeepLinkDispatch
DeepLinkDispatch copied to clipboard
How to compose a deeplink with parameters programmatically ?
Hi,
will be great to introduce API that allows to compose deeplink with parameters programmatically...
- compose deeplink (pseudo code):
return Uri.parse(MainActivity.DEEPLINK_SHOW_ON_MAP)
.buildUpon()
.clearQuery()
.appendQueryParameter("lat", String.valueOf(latLng.latitude))
.appendQueryParameter("lon", String.valueOf(latLng.longitude))
.build();
- trigger deeplink:
/** Trigger deeplink resolving over the deep link handler activity. */
@MainThread
public static boolean trigger(@NonNull final Context context, @NonNull final Uri deeplink) {
final Intent intentLink = new Intent(context, DeepLinkingActivity.class)
.setData(deeplink);
context.startActivity(intentLink);
return true;
}
+1 Is necessary for my project too, we have deeplink internally when you click some button
Deep links are just regular Intent
s with the right Uri
data. You can build them yourself, not sure it's worth implementing an API for this.
Just so I understand, do you want to have a builder that will correctly generate the "http://foo.bar/{var1}/{var2}"
interpolations so you dont have to do it yourself?
in short: YES. needed builder that recognize parameters in path and query. Maybe even recognize optional and required parameters.