InstantAppsClient
Stay organized with collections
Save and categorize content based on your preferences.
This class is deprecated.
Starting December 2025, Instant Apps cannot be published through Google Play, and all Google
Play services Instant APIs will no longer work. To continue optimizing for user growth, we
encourage developers to refer users to their regular app or game, and using deeplinks to
redirect them to specific journeys or features when relevant.
Main entry point to APIs for Android instant apps.
Example use:
InstantAppsClient client = InstantApps.getInstantAppsClient(context);
Task<ParcelFileDescriptor> fileTask = client.getInstantAppData();
fileTask
.addOnCompleteListener(fileTask -> readData(fileTask.getResult()))
.addOnFailureListener(exception -> handleException(exception));
Inherited Method Summary
From class com.google.android.gms.common.api.GoogleApi
From class java.lang.Object
Object
|
clone()
|
boolean |
|
void |
finalize()
|
final Class<?>
|
getClass()
|
int |
hashCode()
|
final void |
notify()
|
final void |
notifyAll()
|
String
|
toString()
|
final void |
wait(long arg0, int arg1)
|
final void |
wait(long arg0)
|
final void |
wait()
|
Public Methods
public Task<Boolean>
areInstantAppsEnabledForDevice ()
Checks whether this device satisfied all preconditions to run instant apps. Default
is false.
Retrieves a ParcelFileDescriptor
to the caller's instant app's data.
The file format is Zip, which is compatible with Android's native ZipOutputStream
and ZipInputStream
.
What is in the Zip file?
Note: Since instant apps cannot access external storage, no information from
external storage will be returned.
Files in directories returned by Context.getCacheDir()
,
Context.getCodeCacheDir()
,
or Context.getNoBackupFilesDir()
are excluded. The files saved in these locations are only needed temporarily, or are
intentionally excluded from transfer operations.
Security Requirements:
- You may only request data for your own package. The package name is implied from
calling
Context.getPackageName()
within your app.
- You must sign your instant apps and your installed apps with the exact same
key(s). i.e. If your instant app has two certificates, your Installed App must as
well.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-07-21 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-07-21 UTC."],[[["\u003cp\u003e\u003ccode\u003eInstantAppsClient\u003c/code\u003e provides APIs for interacting with Android Instant Apps.\u003c/p\u003e\n"],["\u003cp\u003eIt allows developers to check if a device supports Instant Apps and to access the Instant App's data.\u003c/p\u003e\n"],["\u003cp\u003eThe Instant App's data is retrieved as a Zip file containing shared preferences, files, and databases, but excludes cache and external storage data.\u003c/p\u003e\n"],["\u003cp\u003eFor security, data access is restricted to the calling app's package, and both the Instant App and installed app must be signed with the same keys.\u003c/p\u003e\n"]]],[],null,["# InstantAppsClient\n\npublic class **InstantAppsClient** extends [GoogleApi](/android/reference/com/google/android/gms/common/api/GoogleApi)\\\u003c[Api.ApiOptions.NoOptions](/android/reference/com/google/android/gms/common/api/Api.ApiOptions.NoOptions)\\\u003e \n**This class is deprecated.** \n\nStarting December 2025, Instant Apps cannot be published through Google Play, and all Google\nPlay services Instant APIs will no longer work. To continue optimizing for user growth, we\nencourage developers to refer users to their regular app or game, and using deeplinks to\nredirect them to specific journeys or features when relevant.\n\nMain entry point to APIs for Android instant apps.\n\nExample use: \n\n InstantAppsClient client = InstantApps.getInstantAppsClient(context);\n Task\u003cParcelFileDescriptor\u003e fileTask = client.getInstantAppData();\n fileTask\n .addOnCompleteListener(fileTask -\u003e readData(fileTask.getResult()))\n .addOnFailureListener(exception -\u003e handleException(exception));\n \n### Public Method Summary\n\n|--------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Task\\\u003c[Boolean](//developer.android.com/reference/java/lang/Boolean.html)\\\u003e | [areInstantAppsEnabledForDevice](/android/reference/com/google/android/gms/instantapps/InstantAppsClient#areInstantAppsEnabledForDevice())() Checks whether this device satisfied all preconditions to run instant apps. |\n| Task\\\u003c[ParcelFileDescriptor](//developer.android.com/reference/android/os/ParcelFileDescriptor.html)\\\u003e | [getInstantAppData](/android/reference/com/google/android/gms/instantapps/InstantAppsClient#getInstantAppData())() Retrieves a [ParcelFileDescriptor](//developer.android.com/reference/android/os/ParcelFileDescriptor.html) to the caller's instant app's data. |\n\n### Inherited Method Summary\n\nFrom class com.google.android.gms.common.api.GoogleApi \n\n|-------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------|\n| [String](//developer.android.com/reference/java/lang/String.html) | getApiFallbackAttributionTag([Context](//developer.android.com/reference/android/content/Context.html) arg0) |\n\nFrom class java.lang.Object \n\n|----------------------------------------------------------------------------|--------------------------------------------------------------------------------|\n| [Object](//developer.android.com/reference/java/lang/Object.html) | clone() |\n| boolean | equals([Object](//developer.android.com/reference/java/lang/Object.html) arg0) |\n| void | finalize() |\n| final [Class](//developer.android.com/reference/java/lang/Class.html)\\\u003c?\\\u003e | getClass() |\n| int | hashCode() |\n| final void | notify() |\n| final void | notifyAll() |\n| [String](//developer.android.com/reference/java/lang/String.html) | toString() |\n| final void | wait(long arg0, int arg1) |\n| final void | wait(long arg0) |\n| final void | wait() |\n\nPublic Methods\n--------------\n\n#### public Task\\\u003c[Boolean](//developer.android.com/reference/java/lang/Boolean.html)\\\u003e\n**areInstantAppsEnabledForDevice** ()\n\nChecks whether this device satisfied all preconditions to run instant apps. Default\nis false. \n\n#### public Task\\\u003c[ParcelFileDescriptor](//developer.android.com/reference/android/os/ParcelFileDescriptor.html)\\\u003e\n**getInstantAppData** ()\n\nRetrieves a [ParcelFileDescriptor](//developer.android.com/reference/android/os/ParcelFileDescriptor.html)\nto the caller's instant app's data.\n\nThe file format is Zip, which is compatible with Android's native [ZipOutputStream](//developer.android.com/reference/java/util/zip/ZipOutputStream.html)\nand [ZipInputStream](//developer.android.com/reference/java/util/zip/ZipInputStream.html).\n\nWhat is in the Zip file?\n\n- Shared preferences files.\n- Files in the directory returned by [Context.getFilesDir()](//developer.android.com/reference/android/content/Context.html#getFilesDir()).\n- Files in the directory returned by [Context.getDatabasePath(String)](//developer.android.com/reference/android/content/Context.html#getDatabasePath(java.lang.String)), which also includes files created with the [SQLiteOpenHelper](//developer.android.com/reference/android/database/sqlite/SQLiteOpenHelper.html) class.\n- Files in directories created with [Context.getDir(String, int)](//developer.android.com/reference/android/content/Context.html#getDir(java.lang.String,%20int)).\n\n**Note:** Since instant apps cannot access external storage, no information from\nexternal storage will be returned.\n\nFiles in directories returned by [Context.getCacheDir()](//developer.android.com/reference/android/content/Context.html#getCacheDir()),\n[Context.getCodeCacheDir()](//developer.android.com/reference/android/content/Context.html#getCodeCacheDir()),\nor [Context.getNoBackupFilesDir()](//developer.android.com/reference/android/content/Context.html#getNoBackupFilesDir())\nare excluded. The files saved in these locations are only needed temporarily, or are\nintentionally excluded from transfer operations.\n\nSecurity Requirements:\n\n- You may only request data for your own package. The package name is implied from calling [Context.getPackageName()](//developer.android.com/reference/android/content/Context.html#getPackageName()) within your app.\n- You must sign your instant apps and your installed apps with the exact same key(s). i.e. If your instant app has two certificates, your Installed App must as well."]]