問題是把清單文件裏面的android
<data android:scheme="tencent*******" />
設置爲tencent+appid,記得前面必定要加「tencent」,另外,appid得是在騰訊開放後臺申請的微信
代碼裏面以下:app
(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()} } }