利用友盟的分享模块,分享到QQ、QZone以及豆瓣等平台时,没有加图片的情况下,可以将链接分享成功(分享中要跳转的链接),所以以下代码可以没有问题:
new ShareAction(mActivity).setPlatform(share_media).setCallback(mUMShareListener)
.withText(mVideoPlayInfo.videoDesc)
.withTitle(mVideoPlayInfo.videoTitle)
.withTargetUrl(mVideoPlayInfo.link)
.share();
此时分享到微信时虽然可以分享成功,不过却只有描述文字,没有链接(没有链接就不能跳转到要分享的内容,此时分享就没有意义了)。我猜测是将链接包裹图片的吧,类似:
<a href="跳转的链接">
<img/>
</a>
要在微信分享也有链接的话,必须要有图片内容,所以正确的代码如下:
new ShareAction(mActivity).setPlatform(share_media).setCallback(mUMShareListener)
.withText(mVideoPlayInfo.videoDesc)
.withTitle(mVideoPlayInfo.videoTitle)
.withTargetUrl(mVideoPlayInfo.link)
.withMedia(new UMImage(mActivity, mVideoPlayInfo.thumbnail))
.share();