我的上篇文档已经写了关于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小时内删除。
留言与评论(共有 0 条评论) |