添加深层链接到日历描述

Add Deeplink to Calendar description

我想在我的应用程序添加的日历事件的描述中添加深度link。 所以基本上,有一些与事件相关的信息会随时间变化,因此用户在应用程序中打开相关资源是有意义的。我的 deeplink 看起来像那个例子://resource/?somekey=somevalue

日历(可能也是特定于设备的,在那种情况下是在 galaxy s7 上)不会将其标记为 link,这会影响用户体验。

除了使用标准格式如“http://experience.com/resource/?somekey=somevalue”(日历似乎可以识别)之外,还有什么方法可以使其成为可点击的 link 吗?我不想让它看起来像一个网络资源,因为它不是。

我已经尝试将它包装在 html 标签中,但没有成功。

建议? :)

我遇到了同样的问题,如果有人正在寻找答案..这就是我完成它的方式。

  • 首先,您需要在清单中添加(activity 如果用户单击 link 则打开)。

    <activity
            android:name=".ui.splash.SplashActivity"
            android:screenOrientation="portrait">
    
        <intent-filter>
            <action android:name="android.intent.action.MAIN"/>
            <category android:name="android.intent.category.LAUNCHER"/>
        </intent-filter>
    
        <intent-filter>
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />
            <!-- Accepts URIs that begin with "myapp://home” -->
            <data android:scheme="myapp"
                    android:host="home" />
        </intent-filter>
    
    </activity>
    
  • 当创建日历意图或在应用程序 (ContentValues) 中创建事件时,在描述选项(参数 CalendarContract.Events.DESCRIPTION)中,创建如下字符串:

科特林:

val description = "<div>This is the description</div>" +
            "<div><a href=\"myapp://home\">myapp://home</a></div>";

Java:

String description = "<div>This is the description</div>" +
            "<div><a href=\"myapp://home\">myapp://home</a></div>";

然后将其添加到您的描述参数中。

例如: