0

I want to make an android app which will update status in twitter. I am using signpost-core-1.2.1.1 and signpost-commonshttp4-1.2.1.1 jar files.I have given internet uses permission and i have registered app in twitter giving read,write and direct messages permission. Also filled up the callback Url.

code snippet:

private  static  final  String CALLBACK_URI = "app://twitter";
private static final String REQUEST_TOKEN_URL = "https://api.twitter.com/oauth/request_token";
private static final String ACCESS_TOKEN_URL = "https://api.twitter.com/oauth/access_token";
private static final String AUTHORIZE_URL = "https://api.twitter.com/oauth/authorize";

String CONSUMER_KEY = "XXXXXXXXXX";
String CONSUMER_SECRET = "XXXXXXXXXX";

private static  CommonsHttpOAuthConsumer consumer;
private static CommonsHttpOAuthProvider provider;

consumer = new CommonsHttpOAuthConsumer(CONSUMER_KEY, CONSUMER_SECRET);
provider = new DefaultOAuthProvider(REQUEST_TOKEN_URL,ACCESS_TOKEN_URL, AUTHORIZE_URL);
String authUrl="";

authUrl = provider.retrieveRequestToken(consumer,CALLBACK_URI);

I am totally stuck with this.Please reply.

Jan Gerlinger
  • 7,361
  • 1
  • 44
  • 52
sayem siam
  • 1,281
  • 3
  • 13
  • 26

2 Answers2

1

Signpost documentation says DefaultOAuthProvider has some problem with Android implementation of java.net. They suggest use of CommonsHttpOAuthProvider instead. I was having the same problem. This solved this exception in my case. Hope this helps.

anindyaju99
  • 465
  • 1
  • 5
  • 16
0

First By android application we are not allowed to send callbackurl, so use "oob" instead of callbackurl, and there is an api for twitter which is also supported on android, it is jTwitter.

jeet
  • 29,001
  • 6
  • 52
  • 53
  • jTwitter is no more supported by twitter.They have changed the permission model https://dev.twitter.com/docs/application-permission-model – sayem siam Jan 10 '12 at 13:06
  • I have used jTwitter with Android just two months before now. So, there is no restriction. – jeet Jan 10 '12 at 13:18