Android UmengShareSDK 第三方登录- 今天就不废话了,集成平台第三方登录。市面上集成平台有shareSDK 和 Ument两种,shareSDK的ipa和服务好些,如果自己研究会很方便。其他功能错不多,这骗文章将概述Ument的第三方登录。

  1. 首先你得到友盟上去创建帐户和应用这是链接http://www.umeng.com/,获取你应用的Appkey在manifest中配置。
  2. 下载Ument集成SDK,复制res和blis到你工程中或者添加依赖库并配置mainfest。
  3. 在你的主程中定义UMSocialService。建议在application中
    public static final UMSocialService mController = UMServiceFactory .getUMSocialService("com.umeng.share", RequestType.SOCIAL);
  4. 在初始化init中添加监听
  5. mController.getPlatformInfo(this, SHARE_MEDIA.SINA, new UMDataListener() { @Override public void onStart() { }

    @Override public void onComplete(int status, Map<String, Object> info) { // 相关平台的授权信息都以K-V的形式封装在info中 if (status == 200 && info != null) { StringBuilder sb = new StringBuilder(); Set<String> keys = info.keySet(); token = (String) info.get("access_token"); for (String kStr : keys) { sb.append(kStr + "=" + info.get(kStr).toString() + "\r\n"); } Toast.makeText(MainActivity.this, token, 0).show(); GeneralUtil.DebuggingLog(TAG, sb.toString()); } else GeneralUtil.DebuggingLog(TAG, "失败"); } });

    }`

  6. 第三方登录的信息会在回调后的info中以键值对的形式存在。通过setkey可以拿到键集合。

  7. 接下来就可以保存最重要的token了,完事在你的授权监听中添加 mController.doOauthVerify(this, SHAREMEDIA.SINA, new UMAuthListener() { @Override public void onStart(SHAREMEDIA arg0) { }

    @Override public void onError(SocializeException arg0, SHARE_MEDIA arg1) { } @Override public void onComplete(Bundle arg0, SHARE_MEDIA arg1) { Toast.makeText(MainActivity.this, token, 0).show(); } @Override public void onCancel(SHARE_MEDIA arg0) { } });`

  8. onComplete方法就是成功回调,其他可以参考api.

  • Ument第三方登录讲解到此为止,ument的api并没有很详细,在搜索引擎并未能发现比较直接好的例子。如果参照dome可能会走些弯路。希望这个简单直接的教程能够给后辈们一些个启发。

this is not nonsense, integration platform of third party logging. The market integration platform with shareSDK and Ument two, shareSDK IPA and service better, if your research will be very convenient. The other function is not wrong, this article will provide an overview of Ument third logon.

  1. first you get the alliance to create the account and the application of this is the link [http://www.umeng.com/] (http://www.umeng.com/), get your application in the manifest configuration Appkey.
  2. download Ument integrated SDK, copy the res and BLIS to your project or add library dependencies and configuration of mainfest.
  3. in the LORD your process definition UMSocialService. Suggestions in applicationpublic static final UMSocialService mController = UMServiceFactory .getUMSocialService (&quot; com.umeng.share&quot, RequestType.SOCIAL;);
  4. in the initialization init add monitor
  5. mController.getPlatformInfo (this, SHAREMEDIA.SINA, New UMDataListener () { @Override Public (void onStart) { } @Override Public void onComplete (int status, Map<String, Object> info) { / / relevant platform authorization information in the form of K-V package in info If (status = = 200 & & Info! = null) { StringBuilder sb = new (StringBuilder); Set keys = info.keySet (); Token = (String) info.get ("accesstoken"); For (String kStr: Keys) { Sb.append (kStr + "=" Info.get (kStr) + (.ToString) + "\r\n"); } Toast.makeText (MainActivity.this, token,.Show (0)); GeneralUtil.DebuggingLog (TAG, sb.toString) (); } else GeneralUtil.DebuggingLog (TAG, "failure"); } }); }`
  6. third party login information will exist in the form of key / value in the callback after info. Through the setkey can get the key set.
  7. then you can save the most important token, and add mController.doOauthVerify in authorization monitoring your in ( this, SHAREMEDIA.SINA, New UMAuthListener () { @Override Public void onStart (SHAREMEDIA arg0) { } @Override Public void onError (SocializeException arg0, SHARE_MEDIA arg1) { } @Override Public void onComplete (Bundle arg0, SHAREMEDIA arg1) { Toast.makeText (MainActivity.this, token,.Show (0)); } @Override Public void onCancel (SHAREMEDIA arg0) { } ');}
  8. onComplete is a success callback, the other can refer to api.

转载于:https://www.cnblogs.com/qiaoxu/p/3867520.html

Android UmengShareSDK第三方登录相关推荐

  1. android qq第三方登录,Android调用第三方QQ登录代码分享

    本文为大家分享了调用QQ登录的相关代码,希望对大家有帮助,减少项目开发的时间,具体内容如下 1.去QQ开放平台注册帐号(http://open.qq.com/),为应用申请QQ的APP_ID , 并下 ...

  2. android sina oauth2.0 code认证,Android通过第三方登录理解oauth2.0机制

    1. OAuth2.0介绍 说到第三方登录,离不开oauth2.0,oauth2.0是"用户认证和授权的标准",是从oauth1.0基础上发展来的.下图是oauth2.0六个过程分 ...

  3. Android 基于第三方登录(使用Bmob后端云存储数据)实现记忆用户登录、不必重复登录

    最近在开发一个Android 社交app,其中引入了第三方登录的接口,数据存储使用Bmob后端云.有个问题曾困扰了我很久,就是记忆用户登录的问题.众所周知,如果是自己的服务器,进行用户登录,其实完全可 ...

  4. Android实现第三方登录并获取到头像、名字

    首先导入架包 下面还需要一个ImageLoader的依赖,用来加载图片 compile 'com.nostra13.universalimageloader:universal-image-loade ...

  5. Android Facebook第三方登录 20200529

    2020年5月29日09点43分 登录Facebook开发者后台 创建应用 这里点击产品的加号,在右侧选择Facebook登录里面的设置.这样左边的产品下面才会有一个Facebook登录. 打开And ...

  6. android微信第三方登录怎么通过code获取openid?

    2019独角兽企业重金招聘Python工程师标准>>> 方法1: 1.登录公众账号设置OAuth2.0 2.设置菜单按钮URL为OAuth链接 3.页面后台获取: public St ...

  7. android注册的模板下载地址,Android --LoginActivity模板登录

    Android Studio使用自带LoginActivity模板,制作登录界面 登录界面功能: 1.记住表单账户密码,并自动登录 //获得sp实例对象 sp = this.getSharedPref ...

  8. android 第三方登录界面,Android App集成第三方登录与换肤指南

    Android App集成第三方登录与换肤指南 文档编辑 概述 本文主要是介绍了如何通过开源框架快速支持QQ和微信登录,并介绍了如何实现app快速换肤 QQ登录接入 APP要支持QQ登录,需要先到腾讯 ...

  9. Android第三方登录详解2

    接着Android第三方登录详解1讲 1.找到友盟  文档中心 2.找到 3.将 UMSocialService mController = UMServiceFactory.getUMSocialS ...

最新文章

  1. 【PAT乙级】1031 查验身份证 (15 分)
  2. [攻防世界 pwn]——string(内涵peak小知识)
  3. linux利用patch和diff命令制作文件补丁
  4. Android之INSTALL_FAILED_UPDATE_INCOMPATIBLE(pacakge:...do not match the previously installed version)
  5. Win10 C盘空间越来越小怎么办
  6. thttpd服务器修改时间后导致CPU占用率过高
  7. COLING 2020 | 一种从科学文献中提取关键词的基于自蒸馏的联合学习方法
  8. 快速学习django
  9. sublime全解:从菜鸟到大师
  10. 搜索引擎背后的经典数据结构和算法
  11. 画图工具轻松打印长图
  12. CS院校解析 | 清华大学深圳国际研究生院
  13. dragonfly数据库
  14. 我是谁:没有绝对安全的系统黑客手法介绍
  15. 天池比赛-02-用Apriori算法进行商品关联分析
  16. 植物识别扫一扫的软件有哪些?植物识别软件推荐。
  17. C# WinRar 解压缩
  18. nginx完全卸载删除
  19. 多表查询(连接查询)
  20. Java书签 #用Java生成指定位数不重复随机数

热门文章

  1. Spring Session使用
  2. dnf安徒恩服务器不稳定,DNF安图恩掉线怎么办 INS安图恩攻坚战不惧掉线
  3. 去中心化多链钱包CoinU 30问(你想要的答案都在这里)
  4. [以太坊源代码分析] VI. 基于p2p的底层通信(上篇)
  5. Setting up Ethereum smart contract development using Parity on Ubuntu
  6. Android O: View的绘制流程(二):测量
  7. 移动端C#病毒“东山再起”,利用知名应用通信实现远控隐私窃取
  8. 卷积神经网络中不同类型的卷积方式介绍
  9. php页面调用时间戳,php--------获取当前时间、时间戳
  10. linux查询服务器cpu核数_如何查看linux服务器的cpu数量,内核数,和cpu线程数