Specific Activity shareable link in android studio (java)

Viewed 18

I want to make an activity to shareable. When the user clicks on that link instead of the home page of the application, specific activity opens but I don't know how to create this. I made this to share the app link but want to change it to open specific activity(activity name : DifferentScreen).

Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND);
            sharingIntent.setType("text/plain");
            shareBody = "https://play.google.com/store/apps/details?id=com.project.clientdesignDifferentScreen";

            sharingIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Subject Here");
            sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, shareBody);
            startActivity(Intent.createChooser(sharingIntent, "Share via"));
1 Answers

I think what you want is Firebase Dynamic Links: https://firebase.google.com/docs/dynamic-links

For example, you will create https://clientdesign.page.link/different-screen in the Firebase console, and then in the Android app, add a dynamic link handler:

<activity android:name=".DifferentScreen">
  <intent-filter>
    <action android:name="android.intent.action.VIEW"/>
    <category android:name="android.intent.category.DEFAULT"/>
    <category android:name="android.intent.category.BROWSABLE"/>
    <data
        android:host="clientdesign.page.link"
        android:scheme="https"/>
  </intent-filter>
</activity>

The Firebase docs (https://firebase.google.com/docs/dynamic-links/android/receive) has more details on handling the dynamic links.

Related