我正在尝试在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();
}
我的问题是,应用程序代码是什么,我从哪里获得?
最佳答案
步骤1 :
在构建gradle中包括以下内容并同步项目
compile 'com.google.firebase:firebase-invites:10.0.1'
第2步 :
在firebase控制台中打开您的项目,然后单击“深层链接”部分,然后在
粗体部分是您的
app_code
关于android - 在Android版Firebase中用于创建URL深层链接的应用程序代码是什么,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/41529212/