android twitter 登陆授权及分享

阅读: 评论:0

android twitter 登陆授权及分享

android twitter 登陆授权及分享

我的上篇文档已经写了关于linkedin的授权及分享,在此有些地方就不去做描述,只把不同的地方说一下

1、去dev.twitter注册应用获取appkey及secert,

2、让你的应用有读写权限,如果出现这个问题You must add your mobile phone to your Twitter profile before granting your application write capabilities.时,请到你的twitter个人设置里移动互联,激活手机号,+086186.。。。。   无论是否成功,返回授权页再次修改即可成功修改权限。

3、代码不同的地方

	mService =  new ServiceBuilder().provider(TwitterApi.class).apiKey(Constant.CONSUMER_TWITTER_KEY).apiSecret(Constant.CONSUMER_TWITTER_SECRET).callback(Constant.OAUTH_CALLBACK_TWITTER_HOST).build();mRequestToken = RequestToken();authUrl = AuthorizationUrl(mRequestToken);

String tweet = EditableText().toString();try {tweet = de(tweet,"UTF-8");} catch (UnsupportedEncodingException e) {// TODO Auto-generated catch blocke.printStackTrace();}String urlTweet=".1/statuses/update.json?status="+tweet;OAuthRequest request2 = new OAuthRequest(Verb.POST, urlTweet);mService =  new ServiceBuilder().provider(TwitterApi.class).apiKey(Constant.CONSUMER_TWITTER_KEY).apiSecret(Constant.CONSUMER_TWITTER_SECRET).callback(Constant.OAUTH_CALLBACK_TWITTER_HOST).build();Token token = new Token(userToken, userScreet);mService.signRequest(token, request2);Response response = request2.send();Message msg = new Message();String reStr = Body();System.out.Body());System.out.Headers().toString());


本文发布于:2024-02-04 23:06:05,感谢您对本站的认可!

本文链接:https://www.4u4v.net/it/170718454960598.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:android   twitter
留言与评论(共有 0 条评论)
   
验证码:

Copyright ©2019-2022 Comsenz Inc.Powered by ©

网站地图1 网站地图2 网站地图3 网站地图4 网站地图5 网站地图6 网站地图7 网站地图8 网站地图9 网站地图10 网站地图11 网站地图12 网站地图13 网站地图14 网站地图15 网站地图16 网站地图17 网站地图18 网站地图19 网站地图20 网站地图21 网站地图22/a> 网站地图23