ShareLoginLib
ShareLoginLib likes simple sharesdk or umeng in China . It is a tool to help developers to share their content (image , text or webpage ) to WeChat,Weibo and QQ.
??
????
1.??????build.gradle???JitPack??
repositories {
// ... maven {
url "https://jitpack.io"
}
}
2.???????????
compile 'com.github.tianzhijiexian:ShareLoginLib: Latest release (< click it)'
???
compile 'com.github.tianzhijiexian:ShareLoginLib:1.3.8'
??
?????
// ?? SsoLoginManager.login(this, SsoLoginType.XXX, new SsoLoginManager.LoginListener(){
@Override
public void onSuccess(String accessToken, String uId, long expiresIn, @Nullable String wholeData) {
super.onSuccess(accessToken, uId, expiresIn, wholeData);
// must call super
}
@Override
public void onCancel() {
super.onCancel();
// must call super
}
@Override
public void onError(String errorMsg) {
super.onError(errorMsg);
// must call super
}
}
);
// ?? SsoShareManager.share(MainActivity.this, SsoShareType.XXX
new ShareContentWebpage("title", "summary", "http://www.kale.com", mBitmap),
new SsoShareManager.ShareStateListener(){
@Override
public void onSuccess() {
super.onSuccess();
// must call super
}
@Override
public void onCancel() {
super.onCancel();
// must call super
}
@Override
public void onError(String msg) {
super.onError(msg);
// must call super
}
}
);
?????????????
ShareLoginSDK.isWeiXinInstalled(this);
ShareLoginSDK.isWeiBoInstalled(this);
ShareLoginSDK.isQQInstalled(this);
???????????app??????
??token?id??????
SsoUserInfoManager.getUserInfo(context, SsoLoginType.XXX, accessToken, userId,
new UserInfoListener() {
public void onSuccess(@NonNull OAuthUserInfo userInfo) {
// ????????????????id
}
public void onError(String errorMsg) {
}
}
);
?????????????demo?
????
1. ?build.gradle???QQ?key
defaultConfig {
// ...
applicationId "xxx.xxx.xxx" // ??app??
manifestPlaceholders = ["tencentAuthId": "tencent123456"]
// tencent+??AppId
}
2. ??????????
SlConfig config = new SlConfig.Builder()
.debug(false)
.appName("Your App Name")
.picTempFile(null) // ??????????????????????null
.qq(QQ_APPID, QQ_SCOPE)
.weiXin(WEIXIN_APPID, WEIXIN_SECRET)
.weiBo(WEIBO_APPID, WEIBO_REDIRECT_URL, WEIBO_SCOPE).build();
ShareLoginSDK.init(this, config);
????
- ??????????????????????????
- ????app???????
- ???????????????????
- ????????????????AppId?????
- ??app???????sdk????????
???????
- ???????
- ????????
- ?????????????????
- ????????????????????
?????demo???
????????????demo?????????? gradle.properties
?????????????????
STORE_FILE_PATH
xxxxx STORE_PASSWORD
xxxxx KEY_ALIAS
xxxxx KEY_PASSWORD
xxxxx PACKAGE_NAME_SUFFIX
xxxxx TENCENT_AUTHID tencent xxxxx
LICENCE
The MIT License (MIT)
Copyright (c) 2015-2017 kale Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.