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.
Instant Apps Development SDK.
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.
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.
Suppose your app show news by particular city in this case your URL matches
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.
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
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
Here, “android:order” is priority.
For creating Instant app in Android studio,
2. In the Minimum SDK list, select API 23: Android 6.0 (Marshmallow).
3. Under the Minimum SDK list, check Include Android Instant app support.
4. Select an Activity.
5. In the Configure Activity window, do the following:
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.
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.
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.