1、QQ分享出现了只显示分享图片,没有显示分享信息的问题。大多是因为ShareSDK.xml文件设置问题。mob平台解释说:BypassApproval是绕过审核的标记,设置为true后AppId将被忽略,不经过审核的应用也可以执行分享,但是仅限于分享文字和图片,不能分享链接,BypassApproval="false"不绕过审核分享可以分享网页形式的带连接、标题、文本显示分享应用来源、应用图标。
![]()
![](https://i-blog.csdnimg.cn/blog_migrate/c9600db6d390fb26a6161a94e72d426e.png)
一般来说,我们的应用大多通过腾讯审核的,因而除非特殊情况,此处设为false.
2、设置上一步后,如果之前BypassApproval设为true的部分同学会出现QQ分享成功但回调失败的问题。原因在于ShareSDK 3.1.0之后版本,QQ分享在AndroidManifest设置变化。
旧版本是
<activity
android:name="com.mob.tools.MobUIShell"
android:configChanges="keyboardHidden|orientation|screenSize"
android:theme="@android:style/Theme.Translucent.NoTitleBar"
android:windowSoftInputMode="stateHidden|adjustResize">
<!--
如果集成QQ分享,或者使用QQ客户端来进行QQ空间的
分享,须要在此处添加一个对ACTION_VIEW事件的过滤器,
其中的scheme是“tencent”前缀再开发者应用的加上appId。
如果此过滤器不设置,则分享结束以后不能得到正确的回调
-->
<intent-filter>
<data android:scheme="tencent+appId" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
新版本是
<activity
android:name="cn.sharesdk.tencent.qq.ReceiveActivity"
android:launchMode="singleTask"
android:noHistory="true">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="tencent+appId" />
</intent-filter>
</activity>
这两点一致,如果问题还没有解决,可以参考下参数配置:
/**
* 分享
* context
* title 分享标题
* content分享文本
* imageUrl 分享图片
* url 分享链接
*/
public static void onShare(Context context, String title, String content, String imageUrl,String url) {
OnekeyShare oks = new OnekeyShare();
// 分享回调
oks.setCallback(new PlatformActionListenerImpl());
//关闭sso授权
oks.disableSSOWhenAuthorize();
// title标题,印象笔记、邮箱、信息、微信、人人网和QQ空间使用
oks.setTitle(title);
// titleUrl是标题的网络链接,仅在人人网和QQ空间使用
oks.setTitleUrl(url);
// text是分享文本,所有平台都需要这个字段
oks.setText(content);
// 分享内容的连接
oks.setUrl(url);
// 微信、易信分享内容
// 微信图片,微信朋友圈必须
oks.setImageUrl(imageUrl);
// 启动分享GUI
oks.show(context);
}