【问题标题】:Specific Activity shareable link in android studio (java)android studio(java)中的特定活动可共享链接
【发布时间】:2022-09-26 18:23:00
【问题描述】:

我想做一个可以分享的活动。当用户单击该链接而不是应用程序的主页时,会打开特定的活动,但我不知道如何创建它。 我这样做是为了共享应用程序链接,但想将其更改为打开特定活动(活动名称:DifferentialScreen)。

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\"));

    标签: java android android-intent share


    【解决方案1】:

    我认为您想要的是 Firebase 动态链接:https://firebase.google.com/docs/dynamic-links

    例如,您将在 Firebase 控制台中创建 https://clientdesign.page.link/different-screen,然后在 Android 应用中添加动态链接处理程序:

    <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>
    

    Firebase 文档 (https://firebase.google.com/docs/dynamic-links/android/receive) 提供了有关处理动态链接的更多详细信息。

    【讨论】:

    • 我没有在这个项目中使用 firebase。是否可以在没有 Firebase 的情况下创建这样的链接?
    • 不是我知道的。从根本上说,指向 play.google.com 的链接是指向 Play 商店的链接,它只能链接回您应用中的特定活动,因为它与 Firebase 动态链接集成以提供该功能。
    • 如果您不需要链接到 Play 商店(假设您的应用程序已经安装在您的接收设备上),那么您可以简单地使用没有 Firebase 的应用程序链接:developer.android.com/training/app-links/deep-linking
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-08-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多