当前位置: 首页>>代码示例>>Java>>正文


Java AuthenticationClient.getResponse方法代码示例

本文整理汇总了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();
}
 
开发者ID:tkrworks,项目名称:JinsMemeBRIDGE-Android,代码行数:25,代码来源:MainActivity.java

示例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();
        }
    }
}
 
开发者ID:sregg,项目名称:spotify-tv,代码行数:26,代码来源:MainActivity.java

示例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;
        }
    }
}
 
开发者ID:AkshayPall,项目名称:Songify,代码行数:30,代码来源:MainActivity.java

示例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();
    }
}
 
开发者ID:spotify,项目名称:android-auth,代码行数:14,代码来源:MainActivity.java

示例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);
    }
}
 
开发者ID:joxad,项目名称:android-easy-spotify,代码行数:15,代码来源:SpotifyManager.java


注:本文中的com.spotify.sdk.android.authentication.AuthenticationClient.getResponse方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。