Skip to content

Commit a2abe4b

Browse files
committed
Fixes issue codepath#3 for singleTask launchmode activities
1 parent f762c5f commit a2abe4b

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

src/com/codepath/oauth/OAuthLoginActivity.java

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package com.codepath.oauth;
22

3+
import android.content.Intent;
34
import android.net.Uri;
4-
import android.os.Bundle;
55
import android.support.v4.app.FragmentActivity;
66

77
import com.codepath.utils.GenericsUtil;
@@ -11,12 +11,21 @@ public abstract class OAuthLoginActivity<T extends OAuthBaseClient> extends Frag
1111
implements OAuthBaseClient.OAuthAccessHandler {
1212

1313
private T client;
14-
14+
15+
// Use this to properly assign the new intent with callback code
16+
// for activities with a "singleTask" launch mode
17+
@Override
18+
protected void onNewIntent(Intent intent) {
19+
super.onNewIntent(intent);
20+
setIntent(intent);
21+
}
22+
23+
// Extract the uri data and call authorize to retrieve access token
24+
// This is why after the browser redirects to the app, authentication is completed
1525
@SuppressWarnings("unchecked")
1626
@Override
17-
protected void onCreate(Bundle saved) {
18-
super.onCreate(saved);
19-
27+
protected void onResume() {
28+
super.onResume();
2029
Class<T> clientClass = getClientClass();
2130
// Extracts the authenticated url data after the user
2231
// authorizes the OAuth app in the browser

0 commit comments

Comments
 (0)