Android Instant Apps can control deep links?

Asked

Viewed 60 times

1

I need to develop a very simple app prototype.

The app needs to be compatible with Android Instant Apps. The user will open the app without installing it (Instant Apps). User will use Chrome to navigate to https://example.com/path (deep link). The app will show a dialog with "Hello World" automatically as the user navigated to https://example.com/path (deep link on Androidmanifest).

This is possible with Instant Apps or only with installable apps?

Thank you.

  • This is the stack in English. Translate your question here.

  • @I didn’t even notice.

  • @Articuno, you can move to Stackoverflow in English?

  • Just remove the question and redo it :) Or simply translate and keep here,

  • @Articuno, translated, vlw by touch.

1 answer

2

In short: 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

It allows us to associate our app with a URI. When you click the link and you have the app installed on your phone, the app opens. If you don’t have the app installed, an error will occur "Page Not Found". You can 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 on 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 Links App

Requirements

  • Android 6.0
  • You must have a working website.

Lets you associate your website with your app. The user clicks on the link and goes to an Activity specific to your app. If a link fails, instead of giving the error "Page Not Found", 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 (latest versions) allows us to associate our app with our website in a very simple way, just use the Assitant Links App and follow the steps. With the App Links Assistant, you set the host and path. Then it will generate an assetlinks.js file. You should attach that file to your website about the folder /.well-known. The App Links Assistant will define 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: . . .  "]
  }
}]

Browser other questions tagged

You are not signed in. Login or sign up in order to post.