Android ShareSDK快速实现分享功能

2019-12-10 19:11:45刘景俊

  其次,为了授权操作可以顺利完成,需要在application下注册下面的Activity:

<activity
android:name="com.mob.tools.MobUIShell"
android:theme="@android:style/Theme.Translucent.NoTitleBar"
android:configChanges="keyboardHidden|orientation|screenSize"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateHidden|adjustResize" /> 

  如果您的项目集微信或者微信朋友圈,请查看AndroidManifest.xml配置文件里的package路径,需要在package目录下创建wxapi目录再放置WXEntryActivity。 没有此activity在微信分享后回调会检查是否有此activity,没有将会报错。

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

  而如果您的项目集易信的两个平台,请查看AndroidManifest.xml配置文件里的package路径需要在package目录下创建yxapi目录在放置回调Activity:

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

  客户端的操作回调,因此ShareSDK也无法给予您操作回调。为了避免出错,请使用相对路径的方式,直接复制上面的代码到您的AndroidManifest.xml中即可。