0

I made an instant app with multiple feature using Android Studio 3.0 Canary 1. I am running application on Nexus 5X emulator, which is executing only one feature on running application from Android Studio IDE.

Do you have an idea how can we test these multiple features ? What understanding I have once application is live on play store then when you tap a link, Google play will find application which can open the link on basis of app linking.

I have different url for two features, as my url's are also not live which I have in AndroidManifest.xml and application is also not live then how I can test ?

I am in development phase, ofcourse it is not deployed yet on Play Store. How to test multiple features of Instant Apps ?

N Sharma
  • 33,489
  • 95
  • 256
  • 444
  • As of the recent releases, you can test it on emulator as well, from apps like Google Docs. See this for emulator setup: https://developer.android.com/topic/instant-apps/getting-started/setup.html#setup-emulator – Prags Oct 26 '17 at 09:49

2 Answers2

1

Activity1 from Feature1 cannot directly call Activity2 in Feature2. For doing so you must request URL address of Activity2 from Activity1.

An activity cannot launch another activity directly within an instant app; rather, it must request the URL address that corresponds to that activity.

So to open activity2(feature2) you may call this from activity1(feature1)

Intent intent = new Intent(Intent.ACTION_VIEW,Uri.parse("https://yourdomain.com/activity2"));
intent.setPackage(getPackageName());
intent.addCategory(Intent.CATEGORY_BROWSABLE);
startActivity(intent);

By doing so you are calling entry point of Feature2 and the instant app will load Feature2.

Komal12
  • 3,340
  • 4
  • 16
  • 25
Pinkesh Darji
  • 1,041
  • 10
  • 23
0

You can have only one feature per instant app

With Android Instant Apps, users can use a single feature of an app without having to install the app with all its other features. When users request a feature from an instant app, they receive only the code necessary to run that specific feature, no more and no less. After users have finished using the feature, the system can dispose of the feature's code.

In order to run multiple features , you need to have a unique url for each feature.

For example, if you have two features , you can do this

  1. Location finder - http://example.com/finder
  2. Nearby restaurants - http://example.com/restaurants

Each feature within the instant app should have at least one Activity that acts as the entry-point for that feature. An entry-point activity hosts the UI for the feature and defines the overall user flow. When users launch the feature on their device, the entry-point activity is what they see first. A feature can have more than one entry-point activity, but it only needs one.

Dishonered
  • 8,449
  • 9
  • 37
  • 50
  • Yep, I have different url for two features, as my urls are also not live which I have in AndroidManifest.xml and application is also not live then how I can test ? – N Sharma May 26 '17 at 05:34
  • Just test it step for step? So to my understanding you get your first feature, do your stuff, "close" the instant app so the system disposes it and then you can get the second feature and repeat. Did you try that? – Nico May 26 '17 at 05:41
  • @Nico I tried. It closed the complete application, not launching second feature. – N Sharma May 26 '17 at 05:46
  • @Williams so you closed the application after using the first feature and let the system dispose it before starting the second feature? I never tried but that's the only way it has to work to my understanding at the moment. Sure it will not work if you don't dispose the application of the first feature. – Nico May 26 '17 at 05:48
  • @Nico I see that system is not disposing first feature – N Sharma May 26 '17 at 05:50
  • @Williams Then it's weird. Each feature has it's own activity as entry-point as described by Sushobh? If that's the case I am not so sure anymore if it is testeable without publishing it. As long as you can make sure each feature works as instant app on it's own ( trying each on it's own ) and that your second feature has no exception, configuration error etc. it could be that google needs to index it or something. But most likely there is some configuration error I guess. I can't help, sorry :( – Nico May 26 '17 at 06:04
  • Lets call google dev who is taking care of instant app @anirudh . can you see this issue pls.. – N Sharma May 26 '17 at 06:10