How to test instant app with multiple features

房东的猫 提交于 2019-12-13 08:41:35

问题


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 ?


回答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.




回答2:


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.



来源:https://stackoverflow.com/questions/44194187/how-to-test-instant-app-with-multiple-features

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!