为了账号安全,请及时绑定邮箱和手机立即绑定
首页 手记 第三方登录

第三方登录

2018.10.13 13:03 1138浏览

[代码]java代码:

?

01

02

03

04

05

06

07

08

09

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

//登录

  public void login(View v){

      Platform platform11   = ShareSDK.getPlatform(QQ.NAME);

      //platform11.SSOSetting(true);

          platform11.authorize();

          platform11.showUser(null);//必须要加的要不然不行!这个才是授权的!

          tm   = (TelephonyManager) MainActivity.this.getSystemService(TELEPHONY_SERVICE);

          imi   = tm.getDeviceId();

          platform11.setPlatformActionListener(new   PlatformActionListener() {

              @Override

              public   void onError(Platform platform11, int arg1, Throwable arg2) {

                  //弹出失败窗口

              }

              @SuppressLint("SimpleDateFormat")   @Override

              public   void onComplete(Platform platform11, int arg1, HashMap<string,   object="" deep="7"> arg2) {

                  System.out.println("登录成功。。。。");

                  Toast.makeText(MainActivity.this,   "登录成功。。。。", 0).show();

                   

                   

                   

                   

                  /*String   userId = platform11.getDb().getUserId();

                  String   userName = platform11.getDb().getUserName();

                  String   token = platform11.getDb().getToken();

                  long   expiresTime = platform11.getDb().getExpiresTime();

                  SimpleDateFormat   sdf3 = new SimpleDateFormat("yyyy-MM-dd HH:mm");

                  System.out.println("userId      "+userId);

                  System.out.println("userName      "+userName);

                  System.out.println("token       "+token);

                  System.out.println("expiresTime    "+sdf3.format(expiresTime));

                  HttpUties   ht=new HttpUties();

                  ht.UplodePhotos(1+"",   userId+"", userName+"", token+"",   expiresTime+"", imi+"");*/

              }

              @Override

              public   void onCancel(Platform arg0, int arg1) {

                   

              }

          });

  }</string,>

原文链接:http://www.apkbus.com/blog-821322-60955.html

点击查看更多内容
0人点赞

若觉得本文不错,就分享一下吧!

评论

作者其他优质文章

正在加载中
手记
粉丝
9
获赞与收藏
41

关注TA,一起探索更多经验知识

同主题相似文章浏览排行榜

风间影月说签约讲师

51篇手记,涉及Java、MySQL、Redis、Spring等方向

进入讨论

Tony Bai 说签约讲师

151篇手记,涉及Go、C、Java、Python等方向

进入讨论
感谢您的支持,我会继续努力的~
扫码打赏,你说多少就多少
赞赏金额会直接到老师账户
支付方式
打开微信扫一扫,即可进行扫码打赏哦
意见反馈 帮助中心 APP下载
官方微信

举报

0/150
提交
取消