本文整理汇总了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);
}
});
}
示例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();
}
示例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;
}