Search code examples
androidintentfilterapplinks

Unable to get Applinks (with Rivets component) working on Android


I am currently tring to setup deep linking in Android apps.

First, I would like to as if the app be run from any website (meaning host - "example1.com" or "example2.com") if they have the meta tags set correctly?

This is how my test web page looks like:

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">

  <title>Jakubs Applinks Test</title>
  <meta name="description" content="Jakubs Applinks Test">
  <meta name="author" content="Jakub Holovsky">
  <meta property="al:android:url" content="jakubsapp://login" />
  <meta property="al:android:package" content="com.jakubsapp.android" />
  <meta property="al:android:class" content="com.jakubsapp.android.LoginActivity" />
  <meta property="al:android:app_name" content="Jakubs App" />
  <meta property="al:web:url" content="[some fallback url]" />
</head>

<body>
</body>
</html>

In my Android app I put following Intent filter on my activity:

[Activity (Label = "LoginActivity")]
[IntentFilter(new [] {Android.Content.Intent.ActionView }, 
    DataScheme="*", 
    DataHost="jakubsapp",
    DataPath="login",
    Categories=new [] { Android.Content.Intent.CategoryDefault })]
public class LoginActivity : BaseActivity
{

I launch the test site from my phone but nothing happens / gets launched. I am sure there must be something wrong but I am not sure what.

Note that I added Rivets component to my Xamarin Android App.


Solution

  • The URL was wrong, it should have looked like this:

    <meta property="al:android:url" content="http://jakubsapp/login" />
    

    as mentioned in Android documentation:

    <scheme>://<host>:<port>[<path>|<pathPrefix>|<pathPattern>]