友盟第三方登录之QQ登录
申请
- QQ:http://open.qq.com/
- 友盟:http://mobile.umeng.com/apps
需要分别创建应用获取key等
集成
build.gradle中添加
1
2
3
4implementation 'com.umeng.sdk:common:1.5.0'
implementation 'com.umeng.sdk:utdid:1.1.5.3'
debugCompile 'com.umeng.sdk:debug:1.0.0'
implementation 'com.umeng.sdk:share-core:6.9.1'qq jar包需要手动导入(maven库的6.9.1有问题)https://developer.umeng.com/sdk/android
AndroidManifest.xml文件中添加
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18<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${qqappid}" />
</intent-filter>
</activity>
<activity
android:name="com.tencent.connect.common.AssistActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:screenOrientation="portrait"
android:theme="@android:style/Theme.Translucent.NoTitleBar" />${qqappid}中配置qq的appid
Application中onCreate()方法内初始化
1
2
3
4
5
6
7
8
9
10
11/**
* 初始化common库
* 参数1:上下文,不能为空
* 参数2:【友盟+】 AppKey
* 参数3:【友盟+】 Channel
* 参数4:设备类型,UMConfigure.DEVICE_TYPE_PHONE为手机、UMConfigure.DEVICE_TYPE_BOX为盒子,默认为手机
* 参数5:Push推送业务的secret
*/
UMConfigure.init(this, "", "", UMConfigure.DEVICE_TYPE_PHONE, "");
//设置QQ的信息
PlatformConfig.setQQZone(appid,APP KEY);
登录
1 |
|
友盟第三方登录之QQ登录
https://yifengtingyu.cn/2020/09/20/友盟第三方登录之QQ登录/