LiSiFeng19
LiSiFeng19
采纳率50%
2017-01-12 13:08

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

10
已采纳

这个是淘宝跳转,能成功:
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
网上搜了很久都没有找到,自己也尝试了下,还是不行。
有没有谁知道跳转京东商品详情页怎么写???

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

3条回答

  • LiSiFeng19 LiSiFeng19 4年前
          问题解决了,参照(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";
    
    点赞 2 评论 复制链接分享
  • weixin_35937808 城南一霸贾十七 1年前

    集成京东开普勒SDK

    点赞 评论 复制链接分享
  • qq_33181638 qq_33181638 4年前

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

    点赞 评论 复制链接分享

相关推荐