paint-brush
Android Instant Apps,All you need to know about..by@sauge16
11,019 reads
11,019 reads

Android Instant Apps,All you need to know about..

by Rishikesh PathakAugust 31st, 2017
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

<strong>1. What is Android Instant Apps?</strong>

Companies Mentioned

Mention Thumbnail
Mention Thumbnail
featured image - Android Instant Apps,All you need to know about..
Rishikesh Pathak HackerNoon profile picture

Native Android apps, without the installation.

1. What is Android Instant Apps?

As a Developer ever thought to bring users into your apps more quickly and easily.

Android Instant Apps allows Android users to run your apps instantly, without installation. Android users experience what they love about apps — fast and beautiful user interfaces, high performance, and great capabilities — with just a tap.

2. Why you need to make Android Instant Apps?

You can let user try few feature of your native app without installing and they can download installable version when they want.So this brings more customers to your app.

3. How to make Android Instant Apps?

Note:Android Instant Apps only work on Android devices running on Android 6.0 (API level 23) or higher

Android Instant Apps enables native Android applications to run in response to launching a URL, without installing the app. Instant apps can use many Android APIs and you use Android Studio to build them.

Development environment for Android Instant Apps

Instant Apps Development SDK.

  1. Open the Android SDK Manager by clicking Tools > Android > SDK Manager.
  2. Click the SDK Tools tab.
  3. From the list, select Instant Apps Development SDK.
  4. Click Apply.
  5. Click Finish.

opt-in to Android Instant apps in the Settings app of your device by going to Google > Instant Apps. Note that if you do not opt-in, developer mode does not work on the device. The first time you navigate to a instant app, the system automatically asks you to opt-in.

With Android Instant Apps, users can use a single feature of an app without having to install the app with all its other features. Each feature within the instant app should have at least one Activity that acts as the entry-point for that feature. you need to break up your app into smaller modules and refactor them into feature modules.

Every instant app must have one (and only one) base feature APK. You can have feature APKs in addition to your base feature APK ,If your Instant app has more features.

When users request a feature from an instant app, they get two feature APKs: the corresponding feature APK and the base feature APK. If the same user requests another feature from the same instant app, they might receive just the feature APK because they have already downloaded the base feature APK. Of course, if the instant app only has one feature — and thus only a base feature APK — users only receive the base feature APK.

source: developer.android.com

To download a feature of an instant app from Google Play, users need only to click a link. After Google Play finds an instant app that matches the link requested by the user, Google Play sends the corresponding feature APKs for that feature to the user’s device and the Android system then launches the feature. If Google Play cannot find a match, it alerts the Android system. The system then broadcasts an intent to the system to handle the URL.

For this reason, each entry-point activity in an instant app needs to be addressable: it needs to correspond to a unique URL address. To provide a unique URL address for each feature, the instant app specifies a different path underneath the domain for each feature.



Ex: Feature “News” : http://example.com/news Feature “Horoscope” : http://example.com/horoscope

Suppose your app show news by particular city in this case your URL matches



_Ex:_All news : http://example.com/newsBangalore News : http://example.com/news/bangalore.

The URL address for the CityNews activity is similar to the AllNews activity except that the CityNews activity has a city appended to the URL.

The manifest for the feature needs to specify both a path for each activity and a priority order for the activities, in case of multiple matches.


1.Activity Name :AllNewsActivity , url address : http://example.com/news ,priority:12. Activity Name :CityNewsActivity , url address : http://example.com/news/bangalore , priority:100

If Google Play received a request for the URL ‘http://example.com/news/abab', it matches both the AllNews and the CityNews activity. Google Play needs to pick one of the two activities as the starting point for the feature. Because the instant app specifies that the CityNews activity has a higher priority than the AllNews activity, Google Play specifies to the system to start the feature from the CityNews activity

So your manifest will be like
















<application><activity android:name=".AllNewsActivity"><intent-filter android:order="1"><action android:name="android.intent.action.VIEW" /><category android:name="android.intent.category.BROWSABLE" /><category android:name="android.intent.category.DEFAULT" /><data android:host="example.com/news"android:path="/"android:scheme="https" /></intent-filter><intent-filter><action android:name="android.intent.action.MAIN" /><category android:name="android.intent.category.LAUNCHER" /></intent-filter></activity></application>


Here, “android:order” is priority.For creating Instant app in Android studio,

  1. Start a new project

2. In the Minimum SDK list, select API 23: Android 6.0 (Marshmallow).

source: developer.android.com

3. Under the Minimum SDK list, check Include Android Instant app support.

4. Select an Activity.

source: developer.android.com

5. In the Configure Activity window, do the following:

  • In the Instant App URL Host box, enter ‘myfirstinstantapp.example.com’.
  • In the Instant App URL route box, enter ‘/hello’.

6.Finish and Run.

For more details about creating feature module you can see Google codelabs.

Note: When you run your app locally on a device or emulator, the Android system displays the default placeholder icon for your app. Once you have deployed your Instant App APK to the Google Play Console, the appropriate icon shows up when the instant app launches.

Android Instant Apps uses the runtime permission model introduced in Android 6.0 (API level 23).Instant apps can use the Android permissions shown in the list that follows. Any permission not shown in the list is not available to instant apps.

  • BILLING
  • ACCESS_COARSE_LOCATION
  • ACCESS_FINE_LOCATION
  • ACCESS_NETWORK_STATE
  • CAMERA
  • INSTANT_APP_FOREGROUND_SERVICE only in Android O.
  • INTERNET
  • READ_PHONE_NUMBERS only in Android O.
  • RECORD_AUDIO
  • VIBRATE

Note 1: All network traffic from inside the instant app must use HTTPS. Instant Apps does not support HTTP.

Note 2: The sum of the base feature and the feature APK must be under 4MB.

Note 3: Since App Links are regular URLs, apps can force them to be opened inside an in-app browser. Consider using Firebase Dynamic Links to wrap your URLs and guarantee that clicks on your links always take users to your instant app.

You can follow sample code provided by google


  1. Hello World sample appThis sample app demonstrates how to build an installed app and an instant app with the same behaviors. Get it on GitHub


  2. Hello multi feature module sample appThis sample app builds upon the Hello World sample app by moving its code into two feature modules. These modules can be run independently. Get it on GitHub


  3. _Multi feature module sample app_This sample app demonstrates how to build an installed app and an instant app with the same behaviors. The functionality of the instant app is split in two features that you can launch individually on a device. Get it on GitHub


  4. _Build flavors sample app_This sample app demonstrates how to build an installed app and an instant app with the same behaviors. The functionality of the instant app is split in two features that you can launch individually on a device.This sample also uses the concept of build flavors, providing both a “paid” and “free” version of the app. Get it on GitHub


  5. _Google Analytics for Firebase sample app_This sample app demonstrates how to build an installed app and an instant app with the same behaviors. The app integrates Google Analytics for Firebase event logging into both the installed and instant app, demonstrating how to differentiate events raised in the two versions of the app. Get it on GitHub

If you liked my story please click on clap icon and if you want to read future stories by me related to Android Development please follow me.