KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'm following a lot of instructions to make a simple tweet from my app. I've already registered it on Twitter, but I just can't make a tweet. I can login, but not update my status. Here's the code to login private void twitterLogOn() { Twitter twitter = new TwitterFactory().getInstance(); try { twitter.setOAuthConsumer(consumerKey, consumerSecret); rToken = twitter.getOAuthRequestToken(myCallBack); startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(rToken.getAuthenticationURL()))); } catch (IllegalStateException e) { // access token is already available, or consumer key/secret is not // set. if (!twitter.getAuthorization().isEnabled()) { System.out.println("OAuth consumer key/secret is not set."); finish(); } } catch (Exception e) { Toast.makeText(Configuration.this,getString(R.string.networkError), Toast.LENGTH_SHORT).show(); } } That seems to work fine, but when I go back to my app after the login, this next code should be executed, ending always in the exception Toast. public void onResume() { super.onResume(); Uri uri = getIntent().getData(); if (uri != null) { oauthVerifier = uri.getQueryParameter("oauth_verifier"); try { Twitter tt = new TwitterFactory().getInstance(); // Do I need this new twitter instance? tt.setOAuthConsumer(consumerKey, consumerSecret); AccessToken at = tt.getOAuthAccessToken(rToken, oauthVerifier); // Gives the error // Do tweet here ... } catch (Exception e) { Toast.makeText(Configuration.this, "Network Host not responding",Toast.LENGTH_SHORT).show(); } } } Any good hawk eye there that can tel
Tags (comma-separated)
Save Edits
Cancel