這是我在做什麼了SoundCloud
login
web.getSettings().setJavaScriptEnabled(true);
web.loadUrl(url+"&client_id="+CLIENT_ID+"&redirect_uri=http://localhost&response_type=token&scope=non-expiring&display=popup");
web.setWebViewClient(new WebViewClient() {
boolean authComplete = false;
@Override
public void onPageStarted(WebView view, String url, Bitmap favicon){
super.onPageStarted(view, url, favicon);
progress_dialog.show_message("Connecting SoundCloud");
progress_dialog.show_dialog();
}
String authCode="";
@Override
public void onPageFinished(WebView view, String url) {
super.onPageFinished(view, url);
progress_dialog.Cancel_dialog();
Log.i("URLLLL", url);
if (url.contains("access_token=") && authComplete != true) {
for(int t=32;t<url.length();t++){
if(!(url.charAt(t) == '&'))
authCode = authCode+url.charAt(t);
else
break;
}
Log.i("CODE true", "CODE : " + authCode);
authComplete = true;
SharedPreferences.Editor edit = pref.edit();
edit.putString("SoundCloud_Code", authCode);
edit.putInt("SoundCloud_signinflag", 1);
edit.commit();
sign_in_flag = 1;
auth_dialog.dismiss();
new getprofile().execute();
}else if(url.contains("error=access_denied")){
Log.i("CODE false", "ACCESS_DENIED_HERE");
authComplete = true;
auth_dialog.dismiss();
}
}
});
auth_dialog.show();
,它只是工作完美。
請試試這個。
[使用Google+的Soundcloud API移動OAUTH登錄可能重複無法在Android上運行](http://stackoverflow.com/questions/24877284/soundcloud-api-mobile-oauth-login-using-google-isnt- work-on-android) – 2016-07-21 23:23:03