Javascript 在amazon应用程序中打开具有android意图的链接
我正在寻找一个解决方案,打开亚马逊网页直接在亚马逊应用程序。我找到了产品意图方案,如下图所示,它是有效的:Javascript 在amazon应用程序中打开具有android意图的链接,javascript,android,android-intent,Javascript,Android,Android Intent,我正在寻找一个解决方案,打开亚马逊网页直接在亚马逊应用程序。我找到了产品意图方案,如下图所示,它是有效的: String url = "com.amazon.mobile.shopping://amazon.it/products/ASIN"; Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); startActivity(browserIntent);
String url = "com.amazon.mobile.shopping://amazon.it/products/ASIN";
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
startActivity(browserIntent);
现在我正在寻找打开促销页面或其他页面的方案,我设法隔离了amazon用于重定向应用程序中链接的以下脚本,但我无法构建有效的android意图
<script>
P.when('deeplinking-utils').execute(function (DeepLinkingUtils) {
new DeepLinkingUtils.DeepLinkInstance({
"webUrl": "https://www.amazon.it/stores/page/44356AF7-3F18-4DD1-B225-78D8F6C4AE59?_encoding=UTF8&ref_=pe_undef&rw_useCurrentProtocol=1",
"appStoreUrl": "market://details?id=com.amazon.mShop.android.shopping&referrer=utm_campaign%3Dm2cab%26utm_source%3Dm2cab_pdown%26utm_medium%3Dpdown",
"appUrl": "intent://amazon.it/stores/page/44356AF7-3F18-4DD1-B225-78D8F6C4AE59?rw_useCurrentProtocol=1&ref=pe_undef&chgexp=MSHOP&dl_sid=261-1156871-3045023#Intent;scheme=com.amazon.mobile.shopping.web;package=com.amazon.mShop.android.shopping;S.browser_fallback_url=https%3A%2F%2Fwww.amazon.it%2Fstores%2Fpage%2F44356AF7-3F18-4DD1-B225-78D8F6C4AE59%3Frw_useCurrentProtocol%3D1%26ref_%3Dpe_undef;end",
"method": DeepLinkingUtils.Method.INTENTS,
"action": "AutoRedirectAttempted",
"refTag": "mm_an_eml_attempt",
"failAction": "AutoRedirectFailed",
"failRefTag": "mm_an_eml_fail",
"campaignId": "Redirector_EmailRedirector",
"clientToken": "EmailRedirector",
"treatmentId": "an_em",
"openWebUrlOnSuccess": true,
"autoRedirect": true,
"timeout": 1000,
"fallbackMethod": DeepLinkingUtils.Fallback.WEBURL
});
});
</script>
P.when('deeplinking-utils')。执行(函数(DeepLinkingUtils){
新的DeepLinkingUtils.DeepLinkInstance({
“webUrl”:https://www.amazon.it/stores/page/44356AF7-3F18-4DD1-B225-78D8F6C4AE59?_encoding=UTF8&ref_=pe_undef&rw_useCurrentProtocol=1",
“appStoreUrl”:market://details?id=com.amazon.mShop.android.shopping&referrer=utm_campaign%3Dm2cab%26utm_source%3Dm2cab_pdown%26utm_medium%3Dpdown",
“appUrl”:"intent://amazon.it/stores/page/44356AF7-3F18-4DD1-B225-78D8F6C4AE59?rw_useCurrentProtocol=1&ref=pe_undef&chgexp=MSHOP&dl_sid=261-1156871-3045023#Intent;scheme=com.amazon.mobile.shopping.web;package=com.amazon.mShop.android.shopping;S.browser\u fallback\u url=https%3A%2F%2Fwww.amazon.it%2Fstores%2Fpage%2F44356AF7-3F18-4DD1-B225-78D8F6C4AE59%3Frw\u useCurrentProtocol%3D1%26ref_u%3Dpe_未定义;结束“,
“方法”:DeepLinkingUtils.method.INTENTS,
“操作”:“尝试自动恢复”,
“refTag”:“mm\u和eml\u尝试”,
“failAction”:“AutoRedirectFailed”,
“failRefTag”:“mm_an_eml_fail”,
“活动ID”:“重定向器\电子邮件重定向器”,
“clientToken”:“EmailRedirector”,
“治疗ID”:“an_em”,
“openWebUrlOnSuccess”:true,
“自动编辑”:正确,
“超时”:1000,
“fallbackMethod”:DeepLinkingUtils.Fallback.WEBURL
});
});
您有什么想法吗?请尝试为您尝试启动的目的设置程序包
String url = "https://www.amazon.it/stores/page/44356AF7-3F18-4DD1-B225-78D8F6C4AE59?_encoding=UTF8&ref_=pe_undef&rw_useCurrentProtocol=1";
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url))
intent.setPackage("com.amazon.mShop.android.shopping")
startActivity(intent);
但别忘了解决问题,因为如果亚马逊无法处理,就会导致应用程序崩溃
PackageManager packageManager = getActivity().getPackageManager();
if (intent.resolveActivity(packageManager) != null) {
...
}
我找到了此解决方案,请在请求中使用此url:
com.amazon.mobile.shopping.web://amazon.com
方案
com.amazon.mobile.shopping.web
似乎允许在其应用程序中打开亚马逊链接。该方案不起作用,即使在设备上安装了亚马逊应用程序,也找不到该应用程序。找不到可处理该应用程序的活动{act=android.intent.action.VIEW dat=https://www.amazon.it/... pkg=com.amazon.mShop.android.shopping}
@tecn603如果您试图在不调用setPackage的情况下打开亚马逊应用程序,亚马逊应用程序是否会出现在对话框中?如果不是,则意味着亚马逊无法打开该url亚马逊能够打开该url,因为我在问题中发布的脚本能够通过chrome打开的亚马逊页面打开应用程序的url。