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


Java AuthenticationResponse.getAccessToken方法代码示例

本文整理汇总了Java中com.spotify.sdk.android.authentication.AuthenticationResponse.getAccessToken方法的典型用法代码示例。如果您正苦于以下问题:Java AuthenticationResponse.getAccessToken方法的具体用法?Java AuthenticationResponse.getAccessToken怎么用?Java AuthenticationResponse.getAccessToken使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.spotify.sdk.android.authentication.AuthenticationResponse的用法示例。


在下文中一共展示了AuthenticationResponse.getAccessToken方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onAuthenticationComplete

import com.spotify.sdk.android.authentication.AuthenticationResponse; //导入方法依赖的package包/类
private void onAuthenticationComplete(AuthenticationResponse authResponse, String clientID) {
  Log.d("DEBUG", "Got authentication token");
  if (mPlayer == null) {
    Config playerConfig = new Config(this, authResponse.getAccessToken(), clientID);
    mPlayer = Spotify.getPlayer(playerConfig, this, new SpotifyPlayer.InitializationObserver() {
      @Override
      public void onInitialized(SpotifyPlayer player) {
        Log.d("DEBUG", "-- Player initialized --");
        mPlayer
            .setConnectivityStatus(mOperationCallback, getNetworkConnectivity(MainActivity.this));
        mPlayer.addNotificationCallback(MainActivity.this);
        mPlayer.addConnectionStateCallback(MainActivity.this);
      }

      @Override
      public void onError(Throwable error) {
        Log.d("DEBUG", "Error in initialization: " + error.getMessage());
      }
    });
  } else {
    mPlayer.login(authResponse.getAccessToken());
  }
}
 
开发者ID:tkrworks,项目名称:JinsMemeBRIDGE-Android,代码行数:24,代码来源:MainActivity.java

示例2: onNewIntent

import com.spotify.sdk.android.authentication.AuthenticationResponse; //导入方法依赖的package包/类
@Override
protected void onNewIntent(Intent intent) {
    super.onNewIntent(intent);
    Uri uri = intent.getData();
    if (uri != null) {
        AuthenticationResponse response = SpotifyAuthentication.parseOauthResponse(uri);
        Spotify spotify = new Spotify(response.getAccessToken());
        mPlayer = spotify.getPlayer(this, "BeatMap", this, new Player.InitializationObserver()
        {
            @Override
            public void onInitialized() {
                mPlayer.addConnectionStateCallback(LoginActivity.this);
                mPlayer.addPlayerNotificationCallback(LoginActivity.this);


            }

            @Override
            public void onError(Throwable throwable) {
                Log.e("LoginActivity", "Could not initialize player: " + throwable.getMessage());
            }
        });
    }
}
 
开发者ID:ohEmily,项目名称:BeatMap,代码行数:25,代码来源:LoginActivity.java

示例3: onActivityResult

import com.spotify.sdk.android.authentication.AuthenticationResponse; //导入方法依赖的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.AuthenticationResponse; //导入方法依赖的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: onNewIntent

import com.spotify.sdk.android.authentication.AuthenticationResponse; //导入方法依赖的package包/类
@Override
protected void onNewIntent(Intent intent) {
    super.onNewIntent(intent);
    Uri uri = intent.getData();
    Log.i(TAG, "New intent!" + uri);
    if (uri != null) {
        AuthenticationResponse response = SpotifyAuthentication.parseOauthResponse(uri);
        String accessToken = response.getAccessToken();

        Log.i(TAG, "Authentication successful!");
        this.accessToken = accessToken;
    }else{
        Log.i(TAG, "Authentication failed!");
    }
}
 
开发者ID:jpettersson,项目名称:wearify,代码行数:16,代码来源:MainActivity.java


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