Jus*_*ain 9 android deep-linking firebase-dynamic-links
我正在尝试在我的Android应用中使用Firebase动态链接.我对用于构建深层链接的其中一个参数感到困惑.
在演示应用程序中,它调用api来创建用作深层链接的URI.作为其中的一部分,它使用"应用程序代码"作为授权方法的一部分.
public Uri buildDeepLink(@NonNull Uri deepLink, int minVersion, boolean isAd) {
// Get the unique appcode for this app.
String appCode = getString(R.string.app_code);
// Get this app's package name.
String packageName = getApplicationContext().getPackageName();
// Build the link with all required parameters
Uri.Builder builder = new Uri.Builder()
.scheme("https")
.authority(appCode + ".app.goo.gl")
.path("/")
.appendQueryParameter("link", deepLink.toString())
.appendQueryParameter("apn", packageName);
// If the deep link is used in an advertisement, this value must be set to 1.
if (isAd) {
builder.appendQueryParameter("ad", "1");
}
// Minimum version is optional.
if (minVersion > 0) {
builder.appendQueryParameter("amv", Integer.toString(minVersion));
}
// Return the completed deep link.
return builder.build();
}
Run Code Online (Sandbox Code Playgroud)
我的问题是,什么是应用程序代码,我从哪里获得它?
Muh*_*nas 17
第1步:在构建gradle中包含以下内容并同步项目
compile 'com.google.firebase:firebase-invites:10.0.1'
Run Code Online (Sandbox Code Playgroud)
第2步 :
在firebase控制台中打开项目,然后单击深层链接部分和页面顶部
你会看到像https:// test123 .app.goo.gl 这样的链接,其中粗体部分是你的app_code
| 归档时间: |
|
| 查看次数: |
2478 次 |
| 最近记录: |