I've been stuck on this for hours now as the thing was working before but suddenly stopped to behave as expected. I don't really know how and why as I've been re-checking every single line of code in the process without being able to see what's wrong so I'm asking you guys for help.
Alright. So I've a LoginScreen
activity with a button starting a new Intent.ACTION_VIEW
on click. This start the OAUTH proccess in the browser with a ApiManager.OAUTH_CALLBACK_URI
set to stjapp://oauthresponse
.
Here's my AndroidManifest.xml
part for this activity :
<activity
android:name=".LoginScreen"
android:label="@string/application"
android:launchMode="singleTask">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<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="stjapp" android:host="oauthresponse" />
</intent-filter>
</activity>
How I start the Intent.ACTION_VIEW
in my activity :
private View.OnClickListener loginHandler = new View.OnClickListener() {
public void onClick(View v) {
OAuthClientRequest request = null;
try {
request = OAuthClientRequest
.authorizationLocation(ApiManager.OAUTH_AUTHORIZE)
.setClientId(ApiManager.CLIENT_ID).setRedirectURI(ApiManager.OAUTH_CALLBACK_URI)
.buildQueryMessage();
}
catch (OAuthSystemException e) { e.printStackTrace(); }
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(request.getLocationUri() + "&response_type=code"));
startActivity(intent);
}
};
And here's a screenshot of what happens in the browser :
There, I'm supposed to get back to my LoginScreen
activity and handle the code
query parameters within onNewIntent
method but ... yeah, the thing doesn't work as expected anymore.
Any help appreciated.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…