I\'m working on an android application for my research, and I am working with OAuth (signpost library) to gain access to user data from a web service which is also a part of
In order for the callback uri to work properly you need to add an intent filter similar to the following to your manifest in the activity you want to use it in.
<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="appSchema" android:host="appName"/>
</intent-filter>
Now, if your activity is using singleInstance/singleTask, you should use something similar to the following:
@Override
public void onNewIntent(Intent intent) {
super.onNewIntent(intent);
Uri uri = intent.getData();
String oauthToken = uri.getQueryParameter("oauth_token");
String oauthVerifier = uri.getQueryParameter("oauth_verifier");
//...do what you need with the parameters
}
if not using singleTask or singleInstance, you can do
@Override
public void onResume() {
super.onResume();
Intent intent = getIntent();
Uri uri = intent.getData();
String oauthToken = uri.getQueryParameter("oauth_token");
String oauthVerifier = uri.getQueryParameter("oauth_verifier");
//...do what you need with the parameters
}
I believe this should work.
Also, if I'm not mistaken, the callback url you provide should include the ?, so "appSchema://appName?"