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
You should also read
Below are the current known issues and answers to common questions. If you encounter other challenges while developing your instant app, check the Android Instant Apps posts on StackOverflow.
For specific user experience guidelines, see Best practices for user experience in an instant app.
- What devices are supported for Android Instant Apps?
- Android Instant Apps are available on devices running Android 6.0 (API level 23) and higher, with additional support coming for Android 5.0 (API level 21). For example, you can develop instant apps on Google Pixel, Google Nexus, Samsung Galaxy S7, and other popular devices.
- What countries are Android Instant Apps supported in?
- You can find the complete list of supported countries on the support page Distribute your instant app.
- Do developers need to build two different Android apps now?
Developers only need to maintain one project with one source tree. Developers configure the project to create two build artifacts: the installable version and the instant apps version. The effort involved in adding instant app support to an installable app varies depending on how the installable app is currently structured.
Note that instant app version numbers must be the same or less than the last published installable app version.
- What Android APIs and functionality can instant apps use?
- Android Instant Apps functionality complements an existing Android app, but does not replace it. Android Instant Apps uses the same Android APIs, the same project, the same source code. Android Instant Apps restricts some features that might not match users' expectations of an app that is not installed. For example, an instant app can't use background services, do 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. After installation, the app remains on the phone after the user has left the experience. For more information, see the reference documentation
- How do permissions work in Android Instant Apps?
- Android Instant Apps uses the runtime permissions model introduced in Android 6.0 (API level 23).
- Which permissions are available to an instant app?
- 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.
- Are there any limitations on how an app handles network traffic?
- All network traffic from inside the instant app must use HTTPS. Instant Apps does not support HTTP.
- How do developers publish these 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 have a login experience in the instant app must implement Smart Lock by policy. For more information about how to implement Smart Lock in your app, see 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, 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 search. In the search results, the instant app shows up with an app icon and an "Instant" label if there is an instant app associated with URL, similar to how "Installed" apps show up in search results.
- 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. Even so, we are interested in exploring game use cases. Check the Android Instant Apps posts on StackOverflow.
Project structure, features, and architecture
Do instant apps and installable apps have separate
If you build your installable app and instant app from the same Android
Studio project, then yes, the installable app and the instant app need
build.gradlefiles. You must build your installable app from a module that uses the
com.android.applicationbuild rules, while you build your instant app from a module that uses the
com.android.instantappbuild rules. For more information, see Project Structure.
- 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.
You navigate to different activities by launching a URL that corresponds to the desired activity. Given this reason, activities in an instant app need to be URL-addressable. For more information about making activities URL-addressable 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. Having a central routing activity does not allow that. Using 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.
Yes, resources in the base feature are available for all features. Resources contained within a dependent feature can only be used by that feature. For more information about how to structure your project resources and how to share resources between features, see Project Structure.
However, you must keep the IDs for your resources unique between your dependent features and base feature. For example, if your base feature provides a resource with the ID
R.id.feature_layoutand a dependent feature defines another resource with the same ID, the instant app uses the resource from the base feature instead of the dependent feature.
In addition, all the resources referenced by the manifest of a feature module must be present in the base feature module.
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, SQLite, and resources are accessed similarly.
However, instant apps have some restrictions compared to installable APKs. For more information, 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. The installable app and the instant app should feel like the same experience and therefore should use the same visual elements (like icons).
For more information about how to refer to an instant app in relation to its corresponding installable app, see One app, before and after installation.
- How can I tell whether my app is running as an installable app or an instant app?
You can use the static
InstantApps.isInstantApp()method. This method returns true if the current process is an instant app.
For more information about how to use the
InstantApps.isInstantApp()method, see the reference documentation.
- How can I prompt users to install my app from my instant app?
You can use the static
InstantApps.showInstallPrompt()method. This shows a prompt to the user to install the regular APK version of the app.
For more information about how to use the
InstantApps.showInstallPrompt()method, see the reference documentation.
- Do different APKs for features mean different listings in the Google Play?
- 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 on the Java package naming conventions, see the Java documentation.
Analytics, Google Play, and deployment
- Can I restrict my instant app to launch in specific countries?
- Instant apps are restricted to the countries where the installable app is available. Within those countries, developers can choose which countries to target their instant app.
- If I want to test my instant app on a pre-release track through the Google Play, do I still need to have an installable app APK published?
To test your instant app's deployment through the Google Play on the development track, you must have the installable version of your app in a "draft" form in the Google Play Console.
For more information about deploying and testing the deployment of your 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 you can get your app, the easier it is for users to download and use your app. However, once the instant app is running on the user's device, you can download additional data and store the data in internal storage. There is no 4MB hard limit to using data on the device this way.
To calculate the size, unzip the Instant App APK and examine the APK files. You can either use the disk size of the APK files or open up APK Analyzer and look at the "Raw File Size" value.
For an instant app with multiple features, you must add the size of the base feature APK to a single feature APK. The sum of the base feature and the feature feature APK must be under 4MB.
- Do users need to download the base and dependent feature APKs each time they download the same instant app?
When users first download an instant app, they receive the base feature and a dependent feature. When a second feature or feature APK is requested, the user receives only the feature APK for that feature. The base feature is not re-downloaded in this case.
The system can clear the cache of instant apps as needed during garbage collection. If the phone is rebooted, the cache is cleared. If the cache of instant apps is cleared, users must re-download the base feature again.
- When does the 4MB validation happen?
- 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 main app manifest includes other URLs or other URL domains—domains that I don't support or that I don't own. What are the consequences?
- If the domain ownership of a URL is not verified, publishing the instant app fails.
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 going to the Settings app and tapping Google > Instant apps.
- 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 the instant apps process be killed and restarted from Recents or from the device's home screen?
An instant app can be re-started from Recents or by tapping on the URL that previously launched it.
When the user stops interacting with the instant app, the instant app process is killed. However the internal storage of the app like SQLite DBs and shared preferences remain. If the device is severely constrained, the instant app might be evicted and its internal storage deleted. In this unlikely event, developers must restore the instant app state from their servers.
- Can instant apps launch other apps installed on the user's device?
Instant apps can launch an installed app by firing an implicit intent, but they cannot launch most installed apps using an explicit intent. Installed apps can make themselves available to interact with instant through explicit intents.
- If users have an older version of the app installed and they click on an instant app URL with newer features, which opens?
- The installed app always opens instead of the instant app.
- How do users receive new versions of my 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.