汽车离合器调用第三方架包-----百度实践
//加载百度接口架包(百度API-key)
Frontia.ApplicationContext(), Conf.APIKEY);
《第三方登录》
//获得百度第三方登录接口
FrontiaAuthorization mAuthorization = Authorization();
//百度自己登录
ArrayList<String> scope = new ArrayList<String>(); scope.add("帐户") scope.add("密码")
孤雁电视剧mAuthorization.authorize(this,FrontiaAuthorization.String(), scope, new AuthorizationListener());
//新浪微博登录需验证APP-key
ableSSO(所用的登录类型,app-key)-----------激活登录接口(新浪,应用key)
//除百度以外的登录重载
mAuthorization.authorize(activity,登录类型,认证监控事件)------登录认证{
事件:登录成功、登录出错 onFailure 、取消登录 onCancel--方法
//登录成功执行的方法
@Override
public void onSuccess(FrontiaUser result) {
520文案朋友圈 Frontia.setCurrentAccount(result);
if (null != mResultTextView) {
String log = "social id: " + Id() + "\n"
志愿精神指的是什么 + "token: " + AccessToken() + "\n"
+ "expired: " + ExpiresIn();
mResultTextView.setText(log);
}
}
}
mAuthorization.clearAuthorizationInfo(登录类型)-------登录注销、退出登录(新浪、开心、qq、人人、百度)
mAuthorization.clearAllAuthorizationInfos()------退出所有登录,注销
mAuthorization.isAuthorizationReady()-------登录状态验证(true/false)
//获得登录后的用户信息
爆笑喜剧电影UserInfo(登录类型,new UserInfoListener(){
//登录成功拿到的用户信息
@Override
public void onSuccess(FrontiaUser.FrontiaUserDetail result) {
if (null != mResultTextView) {
String resultStr = "username:" + Name() + "\n"
+ "birthday:" + Birthday() + "\n"
+ "city:" + City() + "\n"
+ "province:" + Province() + "\n"
+ "sex:" + Sex() + "\n"
+ "pic url:" + HeadUrl() + "\n";
mResultTextView.setText(resultStr);
}
}
});
《百度社会分享》
FrontiaSocialShare mSocialShare = SocialShare();------获得百度社会分享
//设置分享的上下文
mSocialShare.setContext(this);
//设置
mSocialShare.setClientId(String(), Conf.SINA_APP_KEY);
mSocialShare.setClientId(String(), "100358052");
mSocialShare.setClientId(String(), "100358052");
mSocialShare.setClientName(String(), "百度");
mSocialShare.setClientId(String(), "wx329c742cb69b41b8");
FrontiaSocialShareContent mImageContent = new FrontiaSocialShareContent();-----分享内容对象
//设置分享标题
mImageContent.setTitle("百度开发中心");
//分享中的文字
mImageContent.setContent("欢迎使用百度社会化分享组件,相关问题请邮件dev_support@baidu");
//分享到哪个地址url
mImageContent.setLinkUrl("developer.baidu/");
//分享中的图片
mImageContent.setImageUri(Uri.parse ("apps.bdimg/developer/static/04171450/developer/images/icon/terminal_adapter.png"));
//百度社会分享
mSocialShare.share(mImageContent,String(),new ShareListener(),true);
国庆节节日祝福//分享事件监听
private class ShareListener implements FrontiaSocialShareListener {
@Override
public void onSuccess() {
Log.d("Test","share success");
}
@Override
public void onFailure(int errCode, String errMsg) {
Log.d("Test","share errCode "+errCode);
}
@Override
public void onCancel() {
Log.d("Test","cancel ");
}
}
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论