Android Dev - Callback Url Not Working... (0_o)
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 the dev
Solution 1:
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><actionandroid:name="android.intent.action.VIEW"/><categoryandroid:name="android.intent.category.DEFAULT"/><categoryandroid:name="android.intent.category.BROWSABLE"/><dataandroid:scheme="appSchema"android:host="appName"/></intent-filter>
Now, if your activity is using singleInstance/singleTask, you should use something similar to the following:
@OverridepublicvoidonNewIntent(Intent intent) {
super.onNewIntent(intent);
Uriuri= intent.getData();
StringoauthToken= uri.getQueryParameter("oauth_token");
StringoauthVerifier= uri.getQueryParameter("oauth_verifier");
//...do what you need with the parameters
}
if not using singleTask or singleInstance, you can do
@OverridepublicvoidonResume() {
super.onResume();
Intentintent= getIntent();
Uriuri= intent.getData();
StringoauthToken= uri.getQueryParameter("oauth_token");
StringoauthVerifier= 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?"
Post a Comment for "Android Dev - Callback Url Not Working... (0_o)"