1. 程式人生 > >友盟分享QQ,微信,朋友圈和微博的坑

友盟分享QQ,微信,朋友圈和微博的坑

其實說起來友盟的文件非常完善,開發文件有點小問題,但大多問題錯誤必看部分都有補充,是我目前看到最有良心的第三方了,這裡默默點個贊。以下內容只為了下次開發用到時能夠少走彎路。

1.文件中多了一個Activity

[

新浪:

  <activity
            android:name="com.umeng.socialize.media.WBShareCallBackActivity"
            android:configChanges="keyboardHidden|orientation"
            android:theme
="@android:style/Theme.Translucent.NoTitleBar" android:exported="false" android:screenOrientation="portrait" >
</activity> <activity android:name="com.sina.weibo.sdk.web.WeiboSdkWebActivity" android:configChanges="keyboardHidden|orientation"
android:exported="false" android:windowSoftInputMode="adjustResize">
</activity> <activity android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" android:launchMode="singleTask" android:name
="com.sina.weibo.sdk.share.WbShareTransActivity">
<intent-filter> <action android:name="com.sina.weibo.sdk.action.ACTION_SDK_REQ_ACTIVITY" /> <category android:name="android.intent.category.DEFAULT" /> </intent-filter> </activity>

]

注意,如果只需要分享WeiboSdkWebActivity是不需要加的。

2.微信的配置問題

微信在manifest中時需要配置的,如果不配置,回撥沒反應,分享功能正常(友盟錯誤文件中有寫)

   <activity
            android:name=".wxapi.WXEntryActivity"
            android:configChanges="keyboardHidden|orientation|screenSize"
            android:exported="true"
            android:screenOrientation="portrait"
            android:theme="@android:style/Theme.Translucent.NoTitleBar" />

public class WXEntryActivity extends WXCallbackActivity {
}

3.QQ的配置問題

<activity
            android:name="com.umeng.qq.tencent.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]" />
            </intent-filter>
        </activity>

        <activity
            android:name="com.umeng.qq.tencent.AssistActivity"
            android:screenOrientation="portrait"
            android:theme="@android:style/Theme.Translucent.NoTitleBar"
            android:configChanges="orientation|keyboardHidden|screenSize"/>

[申請的appid]部分需要替換成自己的QQ的appid,這個文件裡面也沒寫,但是友盟的錯誤文件裡面有寫,沒替換時不論QQ是否分享成功失敗都呼叫取消,分享功能正常。

其實還有個問題,好多個平臺選擇留在xx而非返回應用的時候,切迴應用會呼叫友盟的取消分享,這個暫時沒法解決。