Android Instant Apps can control deep links?

1

I need to develop a very simple app prototype.

The app must be compatible with Android Instant Apps. The user will open the app without installing it (Instant Apps). You will use Chrome to navigate to link (deep link). The app will display a dialog with "Hello World", automatically as the user navigated to link (deep link in AndroidManifest).

Is it possible with Instant Apps or only with installable apps?

Thank you.

    
asked by anonymous 07.01.2018 / 19:34

1 answer

2
  

Summarizing : Yes it is possible.

Additional Explanation

For Android Instant Apps it is recommended to use Android App Links (which is equivalent to IOS Universal Links) instead of Deep Links.

Deep Links

Requirements:

  • Android 4.2

Allows us to associate our app with a URI. When the user clicks on the link and if the app is installed on the phone, the app will open. If you do not have the app installed, a "Page Not Found" error will occur. You can associate the link to your app in Intent-filter as follows:

<intent-filter android:label="@string/app_name">
        <action android:name="android.intent.action.VIEW" />
        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.BROWSABLE" />
        <!-- Aceita URI  "http://example.com/path" -->
        <data android:scheme="http"
              android:host="exemple.com"
              android:pathPrefix="/path" />
    </intent-filter>

And then in your activity:

Uri data = this.getIntent().getData();
if (data != null && data.isHierarchical()) {
    String uri = this.getIntent().getDataString();
    Log.i("MyApp", "Deep link clicked " + uri);
}

Android App Links

Requirements

  • Android 6.0
  • You should have a website working.

Allows you to link your website to your app. The user clicks on the link and goes to a specific activity in your app. If a link fails, instead of giving the "Page Not Found" error, the link will direct the user to your web page. Both the instant version and the installable version of your app should implement Android App Links.

Android studio (newer versions) allows us to associate our app with our website in a very simple way, just use the App Links Assitant and follow the steps. With the App Links Assistant, you will define the host and path. It will then generate an assetlinks.json file. You must attach this file to your website on the /.well-known folder. App Links Assistant will set your Intent-filter and do the rest of the work. :)

assetlinks.json

[{
  "relation": ["delegate_permission/common.handle_all_urls"],
  "target": {
    "namespace": "android_app",
    "package_name": "com.example.helloworld",
    "sha256_cert_fingerprints":
    ["49:9C:ED: . . .  "]
  }
}]
    
19.01.2018 / 11:44