I want to add a deeplink to the description of a calendar event that my app adds. So basically, there is some information associated with the event that will change with time so it makes sense for the user to open the associated resource in the app. My deeplink looks like that example://resource/?somekey=somevalue
The calendar (probably also device specific, in that case on a galaxy s7) does not mark it as a link, which sucks for user experience.
Is there any way to make it a clickable link other than using a standard format as "http://experience.com/resource/?somekey=somevalue" (which the calendar seems to recognize) ? I dont want to make it look like a web resource as it isnt.
I already tried wrapping it in html tags but that didnt work out.
Suggestions? :)
I had the same problem and if someone is looking for the answer.. That's how I get it done.
First of all, you need to add in your manifest (activity to open if user click in 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>
When create an intent to calendar or to create event inside app (ContentValues), in Description option (param CalendarContract.Events.DESCRIPTION), create string like this:
Kotlin:
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>";
An then add this in your description param.
Ex.:
Create intent to open calendar, see https://developer.android.com/guide/topics/providers/calendar-provider.html#intents
intent.putExtra(CalendarContract.Events.DESCRIPTION, description);
Add in ContentValues to create event inside app, see https://developer.android.com/guide/topics/providers/calendar-provider.html#add-event
contentValues.put(CalendarContract.Events.DESCRIPTION, description);