platform
platform copied to clipboard
An Android library login and share with third party such as Weibo,Wechat and QQ.
platform
An Android library login and share with third party such as Weibo,Wechat and QQ.
Weibo:MarkMjw
Email:[email protected]
Features
- support Weibo, Wechat, QQ login and share
- request by okhttp
- parse json string with Gson
- easy integration
- open source
Gradle
Add into your build.gradle
compile 'cn.markmjw:library:1.2.0'
Screenshot
Usage
####Config
- Required
PlatformConfig.getInstance()
.initWeibo(WEIBO.KEY, WEIBO.SECRET, WEIBO.CALLBACK, "")
.initWechat(WECHAT.KEY, WECHAT.SECRET, WECHAT.SCOPE, WECHAT.CALLBACK)
.initQQ(QQ.KEY, QQ.SECRET);
####Login
- Login with Weibo
WeiboLoginHandler handler = new WeiboLoginHandler();
handler.setLogEnable(true);
handler.setRequestUserInfo(true);
activity.setLifecycleListener(new ILifecycleListener() {
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
handler.onActivityResult(requestCode, resultCode, data);
activity.setLifecycleListener(null);
}
});
handler.login(activity, new LoginListener());
- Login with Wechat
WechatLoginHandler handler = new WechatLoginHandler();
handler.setLogEnable(true);
handler.setRequestUserInfo(true);
handler.login(new LoginListener());
- Login with QQ
QQLoginHandler handler = new QQLoginHandler();
handler.setLogEnable(true);
handler.setRequestUserInfo(true);
activity.setLifecycleListener(new ILifecycleListener() {
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
handler.onActivityResult(requestCode, resultCode, data);
activity.setLifecycleListener(null);
}
});
handler.login(activity, new LoginListener());
####Share
- Share with Weibo
WeiboHelper.getInstance(context).sendMessage(context, "text", "imagePath");
- Share with Wechat
// share to friend
WechatHelper.getInstance(context).sendFriend("title", "description", "shareUrl", thumbnail);
// share to timeline
WechatHelper.getInstance(context).sendTimeLine("title", "description", "shareUrl", thumbnail);
- Share with QQ
// share to qq friend
QQHelper.getInstance(context).shareToQQWithNetworkImage(activity, "title", "description", "shareUrl", "imageUrl");
// share to qzone
QQHelper.getInstance(context).shareToQzoneWithNetWorkImages(activity, "title", "description", "shareUrl", images);
See more details on the sample
License
Copyright (C) 2015 MarkMjw
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.