public class InstantAppsClient extends GoogleApi<Api.ApiOptions.NoOptions>

Main entry point to APIs for Android Instant Apps.

Example use:

InstantAppsClient client = InstantApps.getInstantAppsClient(context);
 Task<ParcelFileDescriptor> fileTask = client.getInstantAppData();
     .addOnCompleteListener(fileTask -> readData(fileTask.getResult()))
     .addOnFailureListener(exception -> handleException(exception));

Public Method Summary

Retrieves a ParcelFileDescriptor to the caller's instant app's data.

Inherited Method Summary

Public Methods

public Task<ParcelFileDescriptor> getInstantAppData ()

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 getCacheDir(), getCodeCacheDir(), or 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 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.