1

I've been trying all day to connect my app to android but I'm having no luck. I've been searching for hours but all the resources I'm finding are either incomplete or outdated. I've got this so far:

private class MyAsync extends AsyncTask<Void, Void, AccessToken> { @Override protected AccessToken doInBackground(Void... params) { try { requestToken = twitter.getOAuthRequestToken(); Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(requestToken.getAuthorizationURL())); startActivity(browserIntent); } catch (TwitterException e) { e.printStackTrace(); } Log.d("token", "here1"); return token; } } 

The above works as far as opening the authorization page.However when I add a callback URL (as below) the app stops working. It won't even open up a browser anymore:

twitter.getOAuthRequestToken("myapp://callback"); 

I read somewhere I was supposed to add the below intention-filter to the manifest file. But that didn't affect the outcome:

 <intent-filter> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> <data android:scheme="myapp" android:host="callback" /> </intent-filter> 

If it helps I'm using the twitter4j library.

1

1 Answer 1

1

Ok I got it. All I had to to was insert a dummy callback URL in the app's twitter page. Such a counter intuitive and ugly solution.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.