13

From the developer document of Instant Apps

Installed apps can make themselves available to interact with instant through explicit intents.

And later, it is mentioned that instant apps cannot

Discover the list of installed apps on the device, unless the installed apps have made themselves discoverable to instant apps.

But I can't find the details about how to expose the component of an installed app or any part of an app, for that matter, to be visible (and accessible) by instant app. And any limitation on that? (supported component types and etc.)

Reuben Tanner
  • 5,229
  • 3
  • 31
  • 46
Oasis Feng
  • 7,490
  • 3
  • 31
  • 44
  • Let me try to understand here. You want your instant-app to be able to open another app, for example: an action in your instant-app leads to opening Youtube? – TWL Jul 25 '17 at 23:34
  • I want my instant-app to bind to a service exposed by another locally installed app. – Oasis Feng Jul 26 '17 at 07:56
  • Is it not similar to https://stackoverflow.com/questions/13745779/binding-to-a-service-from-another-app ? – TWL Jul 26 '17 at 22:20
  • No, it is not similar...Instant Apps are a new thing. Read about them: https://developer.android.com/topic/instant-apps/index.html – Reuben Tanner Sep 21 '17 at 20:43

1 Answers1

14

At last, I figured out the syntax:

For Android O+, you can specify android:visibleToInstantApps="true" to the component.

For lower version of Android, add this meta-data to your <application> (not working for components):

<meta-data android:name="instantapps.clients.allowed" android:value="true" />

More Info can be found here 3.15. Instant Apps

Prags
  • 2,457
  • 2
  • 21
  • 38
Oasis Feng
  • 7,490
  • 3
  • 31
  • 44
  • example can be look at https://android.googlesource.com/platform/packages/apps/Camera2/+/master/AndroidManifest.xml and https://android.googlesource.com/platform/packages/providers/ContactsProvider/+/master/AndroidManifest.xml – Prags Feb 08 '18 at 09:48
  • Saved my life. Thanks. Where did find the documentation for instaapps.clients.allowed meta-data? Googling seems to reveal exmaples but not the official doc from android... – CoderSpinoza Feb 13 '19 at 09:28