DeepLinkDispatch icon indicating copy to clipboard operation
DeepLinkDispatch copied to clipboard

How to compose a deeplink with parameters programmatically ?

Open OleksandrKucherenko opened this issue 7 years ago • 3 comments

Hi,

will be great to introduce API that allows to compose deeplink with parameters programmatically...

  1. 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();

  1. 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;
    }

OleksandrKucherenko avatar Mar 13 '17 08:03 OleksandrKucherenko

+1 Is necessary for my project too, we have deeplink internally when you click some button

Diego-Franco avatar Apr 16 '17 21:04 Diego-Franco

Deep links are just regular Intents 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?

felipecsl avatar Apr 17 '17 18:04 felipecsl

in short: YES. needed builder that recognize parameters in path and query. Maybe even recognize optional and required parameters.

OleksandrKucherenko avatar Apr 18 '17 11:04 OleksandrKucherenko