ShareSdk

作者: 喂_balabala | 来源:发表于2017-12-26 15:45 被阅读26次

    http://bbs.mob.com/forum.php?mod=viewthread&tid=36&extra=page%3D1%26filter%3Dtypeid%26typeid%3D35

    http://wiki.mob.com/%e4%b8%8d%e5%90%8c%e5%b9%b3%e5%8f%b0%e5%88%86%e4%ba%ab%e5%86%85%e5%ae%b9%e7%9a%84%e8%af%a6%e7%bb%86%e8%af%b4%e6%98%8e/#map-4

    http://wiki.mob.com/%e5%88%86%e4%ba%ab%e5%88%b0%e6%8c%87%e5%ae%9a%e5%b9%b3%e5%8f%b0/

    qq和空间的只改了ShareSdk的ID 没有改key、一定要正式打包、微信开发平台注册的时候填写签名不能有冒号,全部字母要小写,QQ的还要在清单文件中修改scheme

    修改shareSdk中的appid或者appkey

     OnekeyShare oks = new OnekeyShare();
    //关闭sso授权
            oks.disableSSOWhenAuthorize();
    oks.setShareContentCustomizeCallback(new ShareContentCustomizeCallback() {
                @Override
                public void onShare(Platform platform, Platform.ShareParams paramsToShare) {
                    if (Wechat.NAME.equals(platform.getName())){
                        paramsToShare.setTitle(getString(R.string.app_name));
                        paramsToShare.setImageData(BitmapFactory.decodeResource(getResources(),R.mipmap.ic_hzjr));
                        paramsToShare.setUrl(SharedPreferencesUtil.getInstance().getString(mContext,SharedPreferencesUtil.SHARE_URL,""));
                        paramsToShare.setText(SharedPreferencesUtil.getInstance().getString(mContext,SharedPreferencesUtil.SHARE_URL,""));
                        paramsToShare.setShareType(Platform.SHARE_WEBPAGE);
                    }else if (WechatMoments.NAME.equals(platform.getName())){
                        paramsToShare.setImageData(BitmapFactory.decodeResource(getResources(),R.mipmap.ic_hzjr));
                        paramsToShare.setTitle(getString(R.string.app_name));
                        paramsToShare.setUrl(SharedPreferencesUtil.getInstance().getString(mContext,SharedPreferencesUtil.SHARE_URL,""));
                        paramsToShare.setText(SharedPreferencesUtil.getInstance().getString(mContext,SharedPreferencesUtil.SHARE_URL,""));
                        paramsToShare.setShareType(Platform.SHARE_WEBPAGE);
                    }else if (QQ.NAME.equals(platform.getName())){
    //                    paramsToShare.setImageData(BitmapFactory.decodeResource(getResources(),R.mipmap.ic_hzjr));//设置大图
                        paramsToShare.setTitle(getString(R.string.app_name));
                        paramsToShare.setTitleUrl(SharedPreferencesUtil.getInstance().getString(mContext,SharedPreferencesUtil.SHARE_URL,""));
                        paramsToShare.setText(SharedPreferencesUtil.getInstance().getString(mContext,SharedPreferencesUtil.SHARE_URL,""));
    //                    paramsToShare.setShareType(Platform.SHARE_WEBPAGE);
                    }else if (QZone.NAME.equals(platform.getName())){
    //                    paramsToShare.setImageUrl("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1509706436786&di=de24e256f60025ffb70098776ece698d&imgtype=0&src=http%3A%2F%2Fpic33.nipic.com%2F20130907%2F13534366_092511672176_2.jpg");
                        paramsToShare.setTitle(getString(R.string.app_name));
                        paramsToShare.setTitleUrl(SharedPreferencesUtil.getInstance().getString(mContext,SharedPreferencesUtil.SHARE_URL,""));
                        paramsToShare.setText(getString(R.string.app_name));
                        paramsToShare.setSiteUrl(SharedPreferencesUtil.getInstance().getString(mContext,SharedPreferencesUtil.SHARE_URL,""));
                        paramsToShare.setSite(getString(R.string.app_name));//发布分享的网站名称
    //                    paramsToShare.setShareType(Platform.SHARE_WEBPAGE);
                    }else if (ShortMessage.NAME.equals(platform.getName())){
                        paramsToShare.setTitle(getString(R.string.app_name));
                        paramsToShare.setText(SharedPreferencesUtil.getInstance().getString(mContext,SharedPreferencesUtil.SHARE_URL,""));
                    }else if (SinaWeibo.NAME.equals(platform.getName())){
                        paramsToShare.setTitle(getString(R.string.app_name));
                        paramsToShare.setText(SharedPreferencesUtil.getInstance().getString(mContext,SharedPreferencesUtil.SHARE_URL,""));
                    }
                }
            });
    // 启动分享GUI
            oks.show(this);
    

    相关文章

      网友评论

        本文标题:ShareSdk

        本文链接:https://www.haomeiwen.com/subject/qdkjgxtx.html