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


Java SpotifyApi.getService方法代码示例

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


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

示例1: startSpotifySession

import kaaes.spotify.webapi.android.SpotifyApi; //导入方法依赖的package包/类
public void startSpotifySession(final Activity activity, String accessToken, final Runnable onStarted, final Runnable onFailed) {
    // Spotify API
    SpotifyApi api = new SpotifyApi();
    api.setAccessToken(accessToken);
    mSpotifyService = api.getService();

    // Spotify Player Controller
    String clientId = getString(R.string.spotify_client_id);
    Config playerConfig = new Config(this, accessToken, clientId);
    Player player = Spotify.getPlayer(playerConfig, this, null);
    mSpotifyPlayerController = new SpotifyPlayerController(player, mSpotifyService);

    mSpotifyService.getMe(new Callback<UserPrivate>() {
        @Override
        public void success(UserPrivate user, Response response) {
            saveCurrentUser(user);
            activity.runOnUiThread(onStarted);
        }

        @Override
        public void failure(RetrofitError error) {
            activity.runOnUiThread(onFailed);
        }
    });
}
 
开发者ID:sregg,项目名称:spotify-tv,代码行数:26,代码来源:SpotifyTvApplication.java

示例2: getSpotifyService

import kaaes.spotify.webapi.android.SpotifyApi; //导入方法依赖的package包/类
/**
 * Return a SpotifyService object.
 * @return a SpotifyService object
 */
private SpotifyService getSpotifyService() {
    SpotifyApi spotifyApi = new SpotifyApi();

    // Most (but not all) of the Spotify Web API endpoints require authorisation.
    // The ones that require authorisation need the following step:
    //spotifyApi.setAccessToken("myAccessToken");

    return spotifyApi.getService();
}
 
开发者ID:edmundjohnson,项目名称:nd-spotify,代码行数:14,代码来源:ArtistListFragment.java

示例3: doInBackground

import kaaes.spotify.webapi.android.SpotifyApi; //导入方法依赖的package包/类
@Override
protected Void doInBackground(Void... strings) {
    SpotifyApi api = new SpotifyApi();
    SpotifyService service = api.getService();

    ArtistsPager results = service.searchArtists("Paul");
    List<Artist> artists = results.artists.items;
    for (int i = 0; i < artists.size(); i++) {
        Artist artist = artists.get(i);
        Log.i(LOG_TAG, i + " " + artist.name);
    }
    return null;
}
 
开发者ID:udacity,项目名称:android-web-api-sample,代码行数:14,代码来源:MainActivity.java


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