shareSDK_分享—登陆

//分享
    public void onclick(View v){
    		
    		 OnekeyShare oks = new OnekeyShare();
    		 //关闭sso授权
    		 oks.disableSSOWhenAuthorize(); 


    		// 分享时Notification的图标和文字  2.5.9以后的版本不调用此方法
    		 //oks.setNotification(R.drawable.ic_launcher, getString(R.string.app_name));
    		 // title标题,印象笔记、邮箱、信息、微信、人人网和QQ空间使用
    		 oks.setTitle("张良分享");
    		 // titleUrl是标题的网络链接,仅在人人网和QQ空间使用
    		 oks.setTitleUrl("http://sharesdk.cn");
    		 // text是分享文本,所有平台都需要这个字段
    		 oks.setText("我是分享文本");
    		 // imagePath是图片的本地路径,Linked-In以外的平台都支持此参数
    		 //oks.setImagePath("/sdcard/test.jpg");//确保SDcard下面存在此张图片
    		 // url仅在微信(包括好友和朋友圈)中使用
    		 oks.setUrl("http://sharesdk.cn");
    		 // comment是我对这条分享的评论,仅在人人网和QQ空间使用
    		 //oks.setComment("我是测试评论文本");
    		 // site是分享此内容的网站名称,仅在QQ空间使用
    		 oks.setSite("你好哈哈哈");
    		 // siteUrl是分享此内容的网站地址,仅在QQ空间使用
    		 oks.setSiteUrl("http://sharesdk.cn");


    		// 启动分享GUI
    		 oks.show(this);
    }
    //登录
    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> arg2) {
    				
    				System.out.println("登录成功。。。。");
    				
    				
    				
    				
    				/*String userId = platform11.getDb().getUserId();
    				//头像
	    		    String path=platform11.getDb().getUserIcon();
	    		    //用户名
    				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) {
    				
    			}
    		});
    		
    }
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值