Note that there are some explanatory texts on larger screens.

plurals
  1. POandroid - twitter: callback is received but not shown
    text
    copied!<p>I'm trying to figure out for 4 days why my app is not functioning as I expect it to do.</p> <p>My app wants to use OAuth with twitter (Is working) and on the call back it should enter the onNewIntent method. It's not doing that and I can't figure out why.</p> <p>So clicking the twitterbutton opens a webpage where I can enter my credentials. Then I get a screen stating that it was successful and that I will be redirected back to my app. I do get back to my app but the onNewIntent method is never called. I have put a breakpoint at the start of the onNewIntend method and started the debugger. It does not stop on that method! It does stop in other methods so it can't be the debugger.</p> <p>In my log file (included), third line from the bottom, you can see that it is starting a new intent. So..... what is going on here?</p> <p>Can someone please explain? I am very confused.</p> <p>This is my code that gets triggered when the twitterbutton is clicked:</p> <pre><code>callBackURL = "myapp://twitactivity"; httpOauthConsumer = new CommonsHttpOAuthConsumer(consKey, consSec); httpOauthProvider = new DefaultOAuthProvider("http://twitter.com/oauth/request_token","http://twitter.com/oauth/access_token", "http://twitter.com/oauth/authorize"); String authUrl = httpOauthProvider.retrieveRequestToken(httpOauthConsumer, callBackURL); startActivity(new Intent(Intent.ACTION_VIEW,Uri.parse(authUrl))); </code></pre> <p>This is the starting code of my onNewIntent method:</p> <pre><code>public void onNewIntent(Intent intent) { super.onNewIntent(intent); Log.i("onNewIntent", "Yep success."); Uri uri = intent.getData(); if(uri != null &amp;&amp; uri.toString().startsWith(callBackURL)) { String verifier = uri.getQueryParameter(oauth.signpost.OAuth.OAUTH_VERIFIER); etc...... </code></pre> <p>I also have the following in my manifest file:</p> <pre><code>&lt;activity android:name=".TwitterScreen"&gt; &lt;intent-filter&gt; &lt;action android:name="android.intent.action.VIEW" /&gt; &lt;category android:name="android.intent.category.DEFAULT" /&gt; &lt;category android:name="android.intent.category.BROWSABLE" /&gt; &lt;data android:scheme="myapp" android:host="twitactivity" /&gt; &lt;/intent-filter&gt; &lt;/activity&gt; </code></pre> <p>And this is what I see in my log file:</p> <pre><code>01-24 10:23:36.064: INFO/ActivityManager(61): Displayed activity nl.gemoro.android.demo/.TwitterScreen: 6660 ms (total 6660 ms) 01-24 10:23:38.614: INFO/global(348): Default buffer size used in BufferedReader constructor. It would be better to be explicit if an 8k-char buffer is required. 01-24 10:23:44.025: INFO/ActivityManager(61): Starting activity: Intent { act=android.intent.action.VIEW dat=http://twitter.com/oauth/authorize?oauth_token=KjCUNMKg13OClyRjQff94QWKfoRBUpNLE2uF9cJkHA cmp=com.android.browser/.BrowserActivity } 01-24 10:23:44.185: INFO/ActivityManager(61): Start proc com.android.browser for activity com.android.browser/.BrowserActivity: pid=355 uid=10034 gids={3003, 1015} 01-24 10:23:44.724: INFO/ActivityThread(355): Publishing provider browser: com.android.browser.BrowserProvider 01-24 10:23:46.704: INFO/ActivityManager(61): Displayed activity com.android.browser/.BrowserActivity: 2544 ms (total 2544 ms) 01-24 10:23:53.624: WARN/KeyCharacterMap(355): No keyboard for id 0 01-24 10:23:53.624: WARN/KeyCharacterMap(355): Using default keymap: /system/usr/keychars/qwerty.kcm.bin 01-24 10:23:54.574: DEBUG/dalvikvm(348): GC_EXPLICIT freed 3965 objects / 267064 bytes in 2364ms 01-24 10:24:01.064: INFO/ActivityManager(61): Starting activity: Intent { act=android.intent.action.VIEW cat=[android.intent.category.BROWSABLE] dat=myapp://twitactivity?oauth_token=KjCUNMKg13OClyRjQff94QWKfoRBUpNLE2uF9cJkHA&amp;oauth_verifier=41owXswx5TsxHhRyiviFRkRvcpdekm7akRa2IFFM cmp=nl.gemoro.android.demo/.TwitterScreen } 01-24 10:24:02.174: INFO/global(348): Default buffer size used in BufferedReader constructor. It would be better to be explicit if an 8k-char buffer is required. 01-24 10:24:03.594: INFO/ActivityManager(61): Displayed activity nl.gemoro.android.demo/.TwitterScreen: 2412 ms (total 2412 ms) </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload