2 lisifeng19 LiSiFeng19 于 2017.01.12 21:08 提问

android 第三方怎么用intent跳转京东商品详情页?

这个是淘宝跳转,能成功:
Intent intent = new Intent();
intent.setAction("android.intent.action.VIEW");
String url = "https://item.taobao.com/item.htm?id=539789035577&ali_refid=a3_430406_1007:1124066525:N:485184283370953001_0_100:d45485b3013535b0cc4164b7cd5b7523&ali_trackid=1_d45485b3013535b0cc4164b7cd5b7523&spm=a21bo.50862.201874-sales.8.UYm99R";
Uri uri = Uri.parse(url);
intent.setData(uri);
intent.setClassName("com.taobao.taobao", "com.taobao.tao.detail.activity.DetailActivity");
startActivity(intent);
但是借鉴淘宝的写了一个,
String url = "https://item.jd.com/231023.html";
Intent intent = new Intent();
intent.setAction("android.intent.action.VIEW");
Uri uri = Uri.parse(url);
intent.setData(uri);
intent.setClassName("com.jingdong.app.mall", "com.jd.lib.productdetail.ProductDetailActivity");
startActivity(intent);
却报错误java.lang.SecurityException: Permission Denial: starting Intent { act=android.intent.action.VIEW dat=https://item.jd.com/... cmp=com.jingdong.app.mall/com.jd.lib.productdetail.ProductDetailActivity } from ProcessRecord{104461 1853:com.ssss/u0a146} (pid=1853, uid=10146) not exported from uid 10108
网上搜了很久都没有找到,自己也尝试了下,还是不行。
有没有谁知道跳转京东商品详情页怎么写???

2个回答

LiSiFeng19
LiSiFeng19   2017.01.12 22:09
已采纳
      问题解决了,参照(http://www.cocoachina.com/bbs/read.php?tid-1689677.html )用urlscheme跳转京东某个商品页面可行!
                  //            String url = "https://item.jd.com/231023.html";
                    String id = "231023";
        String url = "openapp.jdmobile://virtual?params=%7B%22sourceValue%22:%220_productDetail_97%22,%22des%22:%22productDetail%22,%22skuId%22:%22"+id+"%22,%22category%22:%22jump%22,%22sourceType%22:%22PCUBE_CHANNEL%22%7D";
        Intent intent1 = new Intent();
        intent1.setAction("android.intent.action.VIEW");
        Uri uri = Uri.parse(url);
        intent1.setData(uri);

// intent1.setClassName("com.jingdong.app.mall", "com.jd.lib.productdetail.ProductDetailActivity");
startActivity(intent1);

                    不能单纯地用商品详情页打开,需要提取商品ID,再跳转,如:
                     //            String url = "https://item.jd.com/231023.html";
                    String id = "231023";
        String url = "openapp.jdmobile://virtual?params=%7B%22sourceValue%22:%220_productDetail_97%22,%22des%22:%22productDetail%22,%22skuId%22:%22"+    id   +"%22,%22category%22:%22jump%22,%22sourceType%22:%22PCUBE_CHANNEL%22%7D";
qq_33181638
qq_33181638   2017.11.27 15:51

兄弟,你后来怎么决绝的啊?急啊

Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!