如何测试具有多种功能的即时应用程序

How to test instant app with multiple features

我使用 Android Studio 3.0 Canary 1 制作了一个具有多项功能的即时应用程序。我是 运行 Nexus 5X 模拟器上的应用程序,它仅在 运行 应用程序上执行一项功能来自 Android 工作室 IDE.

您知道我们如何测试这些多项功能吗?一旦应用程序在 Play 商店上线,我的理解是当您点击 link 时,Google play 将找到可以在应用程序 linking 的基础上打开 link 的应用程序.

我有两个不同的 url 功能,因为我的 url 也没有上线,而我在 AndroidManifest.xml 中有并且应用程序也没有上线,那么我该如何测试?

我正处于开发阶段,当然它还没有部署到 Play 商店。如何测试 Instant Apps 的多项功能?

每个免安装应用只能有一项功能

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.

为了 运行 多个功能,您需要为每个功能设置一个唯一的 url。

例如,如果你有两个特征,你可以这样做

  1. 位置查找器 - http://example.com/finder
  2. 附近的餐馆 - 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.

Activity1 来自 Feature1 无法直接调用 Activity2 in Feature2。为此,您必须从 Activity1.[=13 请求 URL address of Activity2 =]

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

所以要打开 activity2(feature2) 你可以从 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);

这样做是在调用 Feature2 的入口点,免安装应用程序将加载 Feature2.