MOB分享官网:http://wiki.mob.com/sdk-share-android-3-0-0/
情景:进行微博分享,然后回到自己的应用,但是没走回调方法。
sinaWeibo.setPlatformActionListener(new PlatformActionListener() {
@Override
public void onComplete(Platform platform, int i, HashMap<String, Object> hashMap) {
ToastUtils.showShortToast("分享成功");
}
@Override
public void onError(Platform platform, int i, Throwable throwable) {
ToastUtils.showShortToast("分享失败");
}
@Override
public void onCancel(Platform platform, int i) {
ToastUtils.showShortToast("分享取消");
}
});
官方解释原因是:在manifests配置清单文件没有微博的回调。
你可以看下你的manifests文件里面这个代码
<activity
android:name="com.mob.tools.MobUIShell"
android:configChanges="keyboardHidden|orientation|screenSize|locale|layoutDirection"
android:theme="@android:style/Theme.NoTitleBar"
android:windowSoftInputMode="stateHidden|adjustResize">
</activity>
没有微博的分享回调。
正确的打开方式:
<activity
android:name="com.mob.tools.MobUIShell"
android:configChanges="keyboardHidden|orientation|screenSize|locale|layoutDirection"
android:theme="@android:style/Theme.NoTitleBar"
android:windowSoftInputMode="stateHidden|adjustResize">
<intent-filter>
<action android:name="com.sina.weibo.sdk.action.ACTION_SDK_REQ_ACTIVITY" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
OK ,亲测,没问题。
微信分享取消,但是走的是微信成功的回调。