问题是把清单文件里面的
<data android:scheme="tencent*******" />
设置为tencent+appid,记得前面一定要加“tencent”,另外,appid得是在腾讯开放后台申请的
代码里面如下:
(Bundle savedInstanceState) { .onCreate(savedInstanceState)setContentView(R.layout.)initUi()initMap()initSocialSDK()} () { .put(shareType.SHARE_MEDIA.).put(shareType.SHARE_MEDIA.).put(shareType.SHARE_MEDIA.).put(shareType.SHARE_MEDIA.).put(shareType.SHARE_MEDIA.)}
/** * 初始化SDK,添加一些平台 */ private void initSocialSDK() { // 添加QQ平台 UMQQSsoHandler qqHandler = new UMQQSsoHandler(content, UmengUtil.QQ_AppId, UmengUtil.QQ_APPKEY); qqHandler.addToSocialSDK(); // 添加QQ空间平台 QZoneSsoHandler qzoneHandler = new QZoneSsoHandler(content, UmengUtil.QQ_AppId, UmengUtil.QQ_APPKEY); qzoneHandler.addToSocialSDK(); UMWXHandler wxHandler = new UMWXHandler(content, WxConstants.APP_ID, WxConstants.App_Secret); wxHandler.addToSocialSDK(); // 支持微信朋友圈 UMWXHandler wxCircleHandler = new UMWXHandler(content, WxConstants.APP_ID, WxConstants.App_Secret); wxCircleHandler.setToCircle(true); wxCircleHandler.addToSocialSDK(); }
(View v) { (v.getId()) { R.id.: finish()R.id.: setShareContent(Configs.shareContent, Configs.shareTitle, url, shareType.QQ);
(String contentStrString titleString targetUrlshareType type) { .registerListener()(type == shareType.) { WeiXinShareContent weixinContent = WeiXinShareContent()weixinContent.setShareContent(contentStr)weixinContent.setTitle(title)weixinContent.setTargetUrl(targetUrl)weixinContent.setShareImage().setShareMedia(weixinContent)} (type == shareType.) { CircleShareContent circleMedia = CircleShareContent()circleMedia.setTitle(title)circleMedia.setShareContent(contentStr)circleMedia.setTargetUrl(targetUrl)circleMedia.setShareImage().setShareMedia(circleMedia)} (type == shareType.) { SinaShareContent sinaContent = SinaShareContent().getConfig().setSinaCallbackUrl()sinaContent.setShareContent(contentStr + targetUrl)sinaContent.setAppWebSite(targetUrl)sinaContent.setTargetUrl(targetUrl)sinaContent.setShareImage().setShareMedia(sinaContent)} (type == shareType.) { QQShareContent qqShareContent = QQShareContent()qqShareContent.setShareContent(contentStr)qqShareContent.setTitle(title)qqShareContent.setTargetUrl(targetUrl).setShareMedia(qqShareContent)} { .setShareContent()} .postShare(.get(type))}
SocializeListeners.SnsPostListener = SocializeListeners.SnsPostListener() { () { Log.()} (SHARE_MEDIA platformstCodeSocializeEntity entity) { Log.(+ stCode)(stCode == ) { Toast.(Toast.) .show()} { Toast.(+ stCodeToast.) .show()} } }
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。