umeng 5.0 共有の概要

        この記事は、解決が難しい同様の問題が今後発生しないように、共有プロセス中に発生した問題の解決策を記録するだけです。

最初に共有し、 http://dev.umeng.com/social/android/android-update#8の統合ドキュメントに従って、必要な構成をすべて追加します。

Sina Weiboのアプリケーションが正常に審査されなかった場合、開発者プラットフォームでテスト番号を追加し、各プラットフォームのアプリケーション情報を完了する必要があることに注意してください。

qq フレンドが AndroidManifest.xml の設定を共有していることに注意してください。

 <activity
            android:name="com.tencent.tauth.AuthActivity"
            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" />//这一步如果写错会导致qq分享成功后回调 onCancel() 并不是正常的onResult();
            </intent-filter>
        </activity>
        <activity
            android:name="com.tencent.connect.common.AssistActivity"
            android:screenOrientation="portrait"
            android:theme="@android:style/Theme.Translucent.NoTitleBar" />



この表は、qq フレンドが http の先頭をクリックした後にデフォルト URL を共有することを示しています。

新浪共有: 共有に失敗しました 1. 夜間に http://open.weibo.com/ Web サイトにアクセスして情報を適用し、必須フィールドに入力する必要があります。

                                      2. ローカル コードでは、packageName の下に WBShareActivity を追加する必要があります。これはデモに反映されています。

Tencent Weibo: onResult() メソッドが Web ページにジャンプせずに共有が成功せずに直接コールバックされるが、これは不正アクセスが原因であり、認証メソッドを追加する必要がある。正常に審査されなかったアプリケーションは Tencent Weibo で共有できません

//Youmeng 共有アイコンの監視をクリックします

private ShareBoardlistener shareBoardlistener = new ShareBoardlistener() {
@Override
public void onclick(SnsPlatform snsPlatform, SHARE_MEDIA share_media) {
if (share_media.equals(SHARE_MEDIA.TENCENT)) {
mShareAPI.doOauthVerify(AboutActivity.this, share_media,
umAuthListener);
} else if (share_media.equals(SHARE_MEDIA.SINA)) {
new ShareAction(AboutActivity.this)
.setPlatform(share_media)
.setCallback(umShareListener)
.withText(
getString(R.string.share_content)
+ download_url).withMedia(image)
.share();//增加图片和内容在这里做,否則分享不成功。//新浪分享在文字後面加String類型的 url,用withTargetUrl并且图片是url分享不成功且显示不正确。用withTargetUrl且图片不是url 分享成功但显示不正确 文字后面会显示分享视频的字样。所以建议url写在文本后面,这样图片是url既可以分享成功又不会显示出错。
} else {
new ShareAction(AboutActivity.this).setPlatform(share_media)
.setCallback(umShareListener)
.withText(getString(R.string.share_content))
.withMedia(image).withTargetUrl(download_url).share();//增加图片和内容在这里做,否則分享不成功。
}
}
};
/** auth callback interface **/
private UMAuthListener umAuthListener = new UMAuthListener() {
@Override
public void onComplete(SHARE_MEDIA platform, int action,
Map<String, String> data) {
// Toast.makeText(getApplicationContext(), "Authorize succeed",
// Toast.LENGTH_SHORT).show();
new ShareAction(AboutActivity.this)
.setPlatform(SHARE_MEDIA.TENCENT)
.setCallback(umShareListener)
.withText(getString(R.string.share_content) + download_url)
.withMedia(image).share();//授权成功后分享,腾讯微博的条目不能点击 所以只能在文本后面添加url 点击url才能跳转网页
}


@Override
public void onError(SHARE_MEDIA platform, int action, Throwable t) {
Toast.makeText(getApplicationContext(), "Authorize fail",
Toast.LENGTH_SHORT).show();
}


@Override
public void onCancel(SHARE_MEDIA platform, int action) {
Toast.makeText(getApplicationContext(), "Authorize cancel",
Toast.LENGTH_SHORT).show();
}
};


@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
/** attention to this below ,must add this **/
mShareAPI.onActivityResult(requestCode, resultCode, data);


}


WeChat 共有: パッケージ名の下にある wxapi--WXEntryActivity.java は言うまでもありません。

これら 3 つの株式の成功に必要な条件は、パッケージに署名することです。 


おすすめ

転載: blog.csdn.net/u010351988/article/details/50622743