我写了一个使用Applinking Huawei生成链接的方法
fun generateLink(text: String, promo: String): Single<String> = Single.create { emitter ->
AppLinking.newBuilder()
.setUriPrefix(Const.Deeplink.BASE_URL_APPLINKING)
.setDeepLink(Uri.parse(Const.Deeplink.BASE_WEB + addParams(mapOf(Const.Deeplink.PARAM_PROMOCODE to promo))))
.setAndroidLinkInfo(AppLinking.AndroidLinkInfo.newBuilder()
.setAndroidDeepLink(AGS + Const.Deeplink.PACKAGE_NAME_ANDROID)
.build()
)
.setIOSLinkInfo(AppLinking.IOSLinkInfo.newBuilder()
.setIOSDeepLink(AGS + Const.Deeplink.PACKAGE_NAME_IOS)
.setBundleId(Const.Deeplink.PACKAGE_NAME_IOS)
.build()
)
.buildShortAppLinking(ShortAppLinking.LENGTH.SHORT)
.addOnSuccessListener { link ->
Timber.e("${link.testUrl}")
text.plus("\n").plus(link.shortUrl?.toString()).also {
emitter.onSuccess(it)
Timber.e(it)
}
}.addOnFailureListener {
var dr = Const.Deeplink.PACKAGE_NAME_ANDROID
var df = Uri.parse(Const.Deeplink.BASE_WEB + addParams(mapOf(Const.Deeplink.PARAM_PROMOCODE to promo)))
emitter.onError(it)
}
}
但是有错误
com.huawei.agconnect.applinking.AppLinkingException: code: 204865654 message: [AppGalleryConnectLinkManageService]the ios bundleId does not have permission
有没有人遇到过这个?PACKAGE_NAME_IOS 是有效的 com.65gb.xxxxx.xxxxx