本文整理汇总了Java中com.spotify.sdk.android.authentication.AuthenticationClient.getResponse方法的典型用法代码示例。如果您正苦于以下问题:Java AuthenticationClient.getResponse方法的具体用法?Java AuthenticationClient.getResponse怎么用?Java AuthenticationClient.getResponse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.spotify.sdk.android.authentication.AuthenticationClient
的用法示例。
在下文中一共展示了AuthenticationClient.getResponse方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: processRequestToken
import com.spotify.sdk.android.authentication.AuthenticationClient; //导入方法依赖的package包/类
String processRequestToken(int requestCode, int resultCode, Intent data) {
if (requestCode == REQUEST_CODE) {
final AuthenticationResponse response = AuthenticationClient.getResponse(resultCode, data);
SpotifyConfigFragment.setAccessToken(response.getAccessToken());
switch (response.getType()) {
case TOKEN:
Log.d("DEBUG", "Spotify Token: " + response.getAccessToken());
onAuthenticationComplete(response, getString(R.string.spotify_client_id));
SpotifyConfigFragment.setIsLoggedIn(true);
break;
case ERROR:
Log.d("DEBUG", "Spotify Error: " + response.getError());
break;
default:
Log.d("DEBUG", "Spotify Other: " + response.getState());
break;
}
}
return SpotifyConfigFragment.getAccessToken();
}
示例2: onActivityResult
import com.spotify.sdk.android.authentication.AuthenticationClient; //导入方法依赖的package包/类
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
super.onActivityResult(requestCode, resultCode, intent);
// Check if result comes from the correct activity
if (requestCode == REQUEST_CODE) {
AuthenticationResponse response = AuthenticationClient.getResponse(resultCode, intent);
if (response.getType() == AuthenticationResponse.Type.TOKEN) {
// TODO progress dialog
SpotifyTvApplication.getInstance().startSpotifySession(MainActivity.this, response.getAccessToken(), new Runnable() {
@Override
public void run() {
init();
}
}, new Runnable() {
@Override
public void run() {
showError();
}
});
} else {
showError();
}
}
}
示例3: onActivityResult
import com.spotify.sdk.android.authentication.AuthenticationClient; //导入方法依赖的package包/类
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
// If logged into Spotify, retrieve an access code to make requests
if (requestCode == LOGIN_REQUEST_CODE) {
AuthenticationResponse response = AuthenticationClient
.getResponse(LOGIN_REQUEST_CODE, data);
switch (response.getType()){
// If received token
case TOKEN:
SpotifyManager.ACCESS_TOKEN = response.getAccessToken();
Log.wtf(TAG, "Got access token");
mSongDataFragment.notifySongDataAdapter();
break;
case ERROR:
SpotifyManager.ACCESS_TOKEN = SpotifyManager.NULL_ACCESS_TOKEN;
Log.wtf(TAG, "ERROR retrieving access token");
break;
case EMPTY:
SpotifyManager.ACCESS_TOKEN = SpotifyManager.NULL_ACCESS_TOKEN;
Log.wtf(TAG, "EMPTY access token");
break;
default:
SpotifyManager.ACCESS_TOKEN = SpotifyManager.NULL_ACCESS_TOKEN;
Log.wtf(TAG, "Could not retrieve access token");
break;
}
}
}
示例4: onActivityResult
import com.spotify.sdk.android.authentication.AuthenticationClient; //导入方法依赖的package包/类
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
final AuthenticationResponse response = AuthenticationClient.getResponse(resultCode, data);
if (AUTH_TOKEN_REQUEST_CODE == requestCode) {
mAccessToken = response.getAccessToken();
updateTokenView();
} else if (AUTH_CODE_REQUEST_CODE == requestCode) {
mAccessCode = response.getCode();
updateCodeView();
}
}
示例5: onActivityResult
import com.spotify.sdk.android.authentication.AuthenticationClient; //导入方法依赖的package包/类
/***
* Manage the answer of Spotify when using the SpotifyActivity using
* {@link #loginWithActivity(Activity, Type, int, String[], OAuthListener)}
*
* @param requestCode
* @param resultCode
* @param intent
*/
public static void onActivityResult(int requestCode, int resultCode, Intent intent) {
if (requestCode == REQUEST_CODE) {
AuthenticationResponse response = AuthenticationClient.getResponse(resultCode, intent);
handleResponse(response);
}
}