【发布时间】:2021-03-17 18:26:52
【问题描述】:
我对 android 本身的动态即时应用文档设置指南感到困惑,因此非常感谢您提供指导和链接 :)
我从阅读文档中了解到,实际的“应用程序”将转换为“基础”,创建另一个动态模块将是“应用程序”,并且对于即时动态模块也没有布局。这是我感到困惑的部分,如果没记错的话,假设我希望我的第二页显示为即时应用程序,应用程序链接需要分配给即时应用程序,我该如何分配它?你下一步怎么做?如果我错了,请纠正我的理解。
我的应用有 2 个页面,第二个页面将包含一个按钮,我根据文档所做的:
-
完成 =
implementation "com.google.android.gms:play-services-instantapps:17.0.0" -
完成 =
android:targetSandboxVersion="2" -
完成 =
<dist:module dist:instant="true" /> -
完成 = `cleartextTrafficPermitted
-
在第二个活动中添加到 onCreate =
private void showInstallPrompt() { Intent postInstall = new Intent(Intent.ACTION_MAIN) .addCategory(Intent.CATEGORY_DEFAULT) .setPackage(your-installed-experience-package-name); // The request code is passed to startActivityForResult(). InstantApps.showInstallPrompt(MyInstantExperienceActivity.this, postInstall, request-code, /* referrer= */ null); } -
创建一个新的 Dynamic 模块并自动添加到 build.gradle 中
a)
implementation project(":app")b)
dynamicFeatures = [":installed_feature"] -
已使用主机方案设置应用链接
-
创建即时动态功能模块
-
下一步是什么?
【问题讨论】:
标签: android android-instant-apps dynamic-feature-module