In this document
- Project structure, features, and architecture
- Analytics, Google Play, and deployment
- App size
- App Links, deep linking, and URL handling
- Running instant apps on a device
This page contains answers to most commonly asked questions or errors that you may encounter while developing an instant app. For more information about user experience guidelines, see Best practices for user experience.
- What devices are supported for Android Instant Apps?
Android Instant Apps are available on the majority of devices running Android 5.0 (API level 21) and higher.
- Do developers need to build two different Android apps?
Developers only need to maintain a single project with a single source tree. They can configure the project to create two build artifacts:
- Installable version
- Instant apps version
The effort involved in adding instant app support to an installable app depends on how the installable app is currently structured.
Note: Instant app version must be the same or lesser than the last published installable app version.
- What are the different types of Android APIs and functionality that
instant apps can use?
Android Instant Apps functionality complements an existing Android app. This means, it does not replace the existing Android app. It uses the same Android APIs, the same project, and the same source code. It restricts some features that may not match users' expectations of an app that is not installed. For example, an instant app cannot use background services, send background notifications, or access unique device identifiers.
- Can users choose to install the app permanently?
Developers can allow users to install the app from the Google Play by using the
How do permissions work in Android Instant Apps?
Android Instant Apps uses the runtime permissions model that was introduced in Android 6.0 (API level 23).
- Which permissions are available to an instant app?
Instant apps can use the following Android permissions:
- Are there any limitations on how an instant app handles network
All the network traffic from inside instant apps must use
HTTPS. Instant apps does not support
- How do developers publish instant apps?
Developers publish their instant apps through the Google Play Console, similar to their existing Android apps. For more information, see Distribute your instant app.
- Is Smart Lock required for instant apps?
Yes, apps that require users to log in must implement Smart Lock for Passwords on Android.
- Can I implement an instant app without an installable Android app?
No, you need to have an installable version of your Android app in the Google Play.
- Can we use WebPs for views?
Yes, you should use WebP format images for views. For more information about using WebP, see Reducing Image Download Sizes.
- How do instant apps show up in Google web search?
Instant apps show up the same way as an installable app shows up in the search results. If there is an instant app associated with the URL, the app shows up with an app icon and a label with the text "Instant".
- Can I use Android Instant Apps to distribute my game?
Games are a highly specialized category of apps, and often have unique tools, large assets, and high performance requirements.
Project structure, features, and architecture
- Do instant apps and installable apps have separate
You need two separate
build.gradlefiles if you build your installable app and instant app from the same Android Studio project.
- Build your installable app from a module that uses the
- Build your instant app from a module that uses the
For more information about understanding the project structure of instant app, see Project Structure.
- Build your installable app from a module that uses the
- Can I build my installable app separately from my instant app?
The recommended project structure, as shown in Project Structure, prioritizes separating functionality into library modules, where the installable app and instant app depend on those library modules. If you follow the recommended project structure, you can build each feature separately from the installable app.
- Is NDK supported on my instant app?
Yes. NDK is supported on devices running Android 5.0 (API level 21) and higher.
- How do I navigate between activities in an instant app?
You can navigate between different activities by launching a URL dedicated in a different feature. You need to address activities through a URL. For more information about addressing activities via a URL and implementing app links, see Requesting features from Google Play and Implement app links.
- Can I use a routing activity in my main app that deals with deep links
and calls other activities as needed?
Instant apps also need to be functionally modular. A central routing activity restricts modularization. Using Android App Links allows the Android framework to do the routing, while enabling more modularization.
- Can I have multiple activities in a single feature?
You can have multiple activities within a single feature. However, you must be mindful of the 4MB size limit for instant app downloads. Also, each feature needs to have a single activity as its entry point.
- Can I share resources between features?
Yes, resources in the base feature are available for all the features. Resources contained within a dependent feature is limited to that specific feature. For more information about structuring your project resources and sharing resources between features, see Project Structure.
You must keep the file-based resources' names distinct between your dependent features and base feature. For example, if your base feature defines a layout in
res/layout/feature_layout.xmland a dependent feature defines another layout with the same file name, the instant app might load the layout from the dependent feature when actually the layout from the base feature is expected.
In addition, all the resources referenced by the manifest of a feature module must be present in the base feature module.
- If there are two features in the app, do they share memory?
Yes, the features run in the same process and share the application context. As long as they belong to the same instant app, features act similarly to different components of a single app. Components like storage and resources are accessed similarly.
However, instant apps have some restrictions compared to installable APKs. For more information about restrictions, see Identify restricted and unsupported features.
- Can I have multiple fragments in a view-pager within a single activity?
Yes, you can have multiple fragments in a single activity and define the fragments relevant to the activity within the feature. Activities must be the primary entry point within a feature. Keep in mind that fragments cannot be associated with a deep link and cannot be launched independently of an activity.
- Should the instant app have a separate launcher icon?
No, the instant app and the installable app should share the same icon as it is important that both the apps provide the same look-and-feel. Therefore, you should use the same visual elements for both the apps. For more information about referring an instant app in relation to its corresponding installable app, see One app, before and after installation.
- How can I find out if my app is running as an installable app or an
isInstantApp()method. The method returns
trueif the current process is an instant app.
- How can I prompt users to install my app from my instant app?
showInstallPrompt()method. This shows a prompt to the user to install the regular APK version of the app.
- Do different APKs for features mean different listings in the
No, the instant app and the installable app share the same package name and listing.
- Are there any restrictions on how I name features within my instant app?
Feature modules follow the naming conventions established for Java package names. As an example, you cannot use hyphens in feature names. For more information about Java package naming conventions, see Java documentation.
- How do I transfer data from an instant app to an installed app?
For devices running Android 8.0 (API level 26) or higher, the instant app's data is transferred automatically when the APK installation begins. For devices running Android 7.1.1 (API level 25) or lower, call compatibility API in Google Play Services. See the reference documentation
Analytics, Google Play, and deployment
- Can I restrict my instant app to launch in specific countries?
Instant apps are limited to the countries where the installable app is available. Within those countries, developers can choose countries to target their instant app.
- Do I need to publish an installable app to test my instant app
on a pre-release track through the Google Play?
To test your instant app's deployment on the development track through Google Play, you must have a draft form of your app's installable version in the Google Play Console. For more information about deploying and testing an instant app, see Distribute your instant app.
- What does the 4MB total download limit mean?
The size of the instant app (base feature plus any included dependent feature) should be as small as possible. The smaller your app, the easier it is for the users to download. However, once the instant app is running on the user's device, you can download additional data and store it in the internal storage. There is no 4MB hard limit for storing data in the internal storage of the device.
To calculate the size, unzip the Instant App APK and examine the APK APK files. You can either use the disk size of the APK files or open the APK Analyzer and check the
Raw File Sizevalue.
For an instant app with multiple features, you must add the size of the base feature APK to a single feature APK. The total size of both these APKs must be under 4MB.
- How do density, ABI, or language APKs affect the 4MB
Feature size is calculated by adding the feature APK size, the base feature APK size, the largest language, screen density, and ABI APK sizes that are associated with the feature. For example, if a feature has three languages, one screen density, and no ABI APKs, the final feature APK size is derived by adding the feature APK size, base feature, the largest language APK, and the one screen density APK.
- Do users need to download the base and dependent feature APKs each time
they download the same instant app?
When users download an instant app, they receive the base feature and the dependent feature. When a second feature or feature APK is requested, the user receives only the feature APK for that specific feature. In such case, the base feature is not downloaded again.
The system can clear the cache of instant apps as needed during garbage collection. If the user reboots the phone, the instant apps cache is cleared. This means that users must re-download the base feature.
- When does the 4MB validation occur?
The validation occurs when you upload your instant app to the production track of the Google Play Console.
App Links, deep linking, and URL handling
- My links do not open in an instant app when they are clicked from some
other apps. They open inside an in-app browser instead. Is there a way to
ensure that users are taken to an instant app?
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 links always open in your instant app.
- My main app manifest includes other URLs or other URL domains that
I don't support or own. What are the consequences?
If the domain ownership of a URL is not verified, the instant app will not publish.
Running instant apps on a device
- Is there a way for users to opt out from Android Instant Apps?
Yes. Users can opt out when they first launch an instant app. They can also opt out by turning off the instant apps from Settings.
- Can two instant apps run in parallel?
Yes, instant apps can run in parallel and users can switch between them. Only the instant app in the foreground has an icon in the notification shade.
- Can a user kill instant apps process and restart it from Recents or
from the device's home screen?
A user can restart an instant app from Recents or by tapping on the URL that previously launched it.
The instant app process is killed when the instant app goes in an idle state. However, the internal storage of the app like SQLite DBs and shared preferences remain active. If the device is severely constrained, the instant app might be evicted and its internal storage is deleted. In this unlikely event, you must restore the instant app state from their servers.
- Can instant apps launch other apps that are installed on the user's
Instant apps can launch an installed app by firing an implicit intent. However, it cannot launch most installed apps using an explicit intent. Installed apps can make themselves available to interact with instant apps through explicit intents.
- Which app opens when a user have an older version of the app installed
and clicks on an instant app URL with newer features?
The installed app always takes a preference over an instant app.
- How do users receive new versions of an instant app? Does Google
automatically update it on users' devices?
The latest version of the instant app is served to new users and existing users whose instant apps cache has expired.