第三方分享和登录,支持微信、QQ、微博、钉钉
第三方 | 授权 | 登录 |
---|---|---|
微信 | ☑️ | ☑️ |
☑️ | ☑️ | |
微博 | ☑️ | ☑️ |
钉钉 | ☑️ | ☑️ |
第三方 | 分享文字 | 分享图片 | 分享链接 | 分享小程序 | 唤起小程序 |
---|---|---|---|---|---|
微信 | ☑️ | ☑️ | ☑️ | ☑️ | ☑️ |
朋友圈 | ☑️ | ☑️ | ☑️ | ||
☑️ 无回调 | ☑️ | ☑️ | |||
QQ空间 | ☑️ | ☑️ | ☑️ | ||
微博 | ☑️ | ☑️ | ☑️ | ||
钉钉 | ☑️ | ☑️ | ☑️ |
- 微信分享回调 不再返回用户是否分享完成事件,cancel事件和success事件统一为success事件。微信官方分享功能调整公告
- QQ原生SDK不支持纯文本分享,本库通过指定Activity跳转实现,故无分享回调。
👉️ socialgo
第三方社会化库的配置中心
👉️ sharego
分享核心
👉️ authgo
授权登录核心
👉️ sample
例子
implementation 'com.gentriolee.socialgo:sharego:1.1.1' //分享
implementation 'com.gentriolee.socialgo:authgo:1.1.1' //授权&登录
<!--QQ配置开始-->
<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"/>
<!-- tencent + qqId -->
<data android:scheme="tencent*********"/>
</intent-filter>
</activity>
<activity
android:name="com.tencent.connect.common.AssistActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:theme="@android:style/Theme.Translucent.NoTitleBar"/>
<!--QQ配置结束-->
<!-- 钉钉分享授权配置开始(该Activity自行创建放在当前工程的包下) -->
<activity
android:name=".ddshare.DDShareActivity"
android:exported="true"
android:theme="@android:style/Theme.Translucent.NoTitleBar" />
<!-- 钉钉分享授权配置结束 -->
<!-- 微信分享授权配置开始(该Activity自行创建放在当前工程的包下) -->
<activity
android:name=".wxapi.WXEntryActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:exported="true"
android:launchMode="singleTask"
android:theme="@android:style/Theme.Translucent.NoTitleBar" />
<!-- 微信分享授权配置结束 -->
推荐在Application生命周期中初始化
SocialConfig.Builder builder = new SocialConfig.Builder()
.setQqAppId("")
.setWxAppId("", "")
.setWbAppId("", "")
.setDdAppId("", "")
.build();
SocialConfig.init(getApplicationContext(), builder);
@Override
public void onReq(BaseReq baseReq) {
SocialGo.onDDAPIHandlerReq(baseReq);
}
@Override
public void onResp(BaseResp baseResp) {
SocialGo.onDDAPIHandlerResp(baseResp);
finish();
}
@Override
public void onReq(BaseReq baseReq) {
SocialGo.onWXAPIHandlerReq(baseReq);
}
@Override
public void onResp(BaseResp baseResp) {
SocialGo.onWXAPIHandlerResp(baseResp);
finish();
}
@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
SocialGo.onActivityResult(requestCode, resultCode, data);
super.onActivityResult(requestCode, resultCode, data);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
SocialGo.onActivityResult(requestCode, resultCode, data);
super.onActivityResult(requestCode, resultCode, data);
}
@Override
protected void onNewIntent(Intent intent) {
SocialGo.onNewIntent(intent);
super.onNewIntent(intent);
}
ShareGo.getInstance().share();
ShareGo.getInstance().shareWX();
ShareGo.getInstance().shareQQ();
ShareGo.getInstance().shareWB();
ShareGo.getInstance().shareDD();
ShareGo.getInstance().launchWX();
AuthGo.getInstance().auth();
AuthGo.getInstance().authWX();
AuthGo.getInstance().authQQ();
AuthGo.getInstance().authWB();
AuthGo.getInstance().authDD();
AuthGo.getInstance().login();
AuthGo.getInstance().loginWX();
AuthGo.getInstance().loginQQ();
AuthGo.getInstance().loginWB();
AuthGo.getInstance().loginDD();
Copyright 2018 gentrio
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.