kaaes.spotify.webapi.android.SpotifyApi Java Examples

The following examples show how to use kaaes.spotify.webapi.android.SpotifyApi. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MainActivity.java    From android-spotify-demo with MIT License 5 votes vote down vote up
private void setServiceAPI(){
    Log.d(TAG, "Setting Spotify API Service");
    SpotifyApi api = new SpotifyApi();
    api.setAccessToken(AUTH_TOKEN);

    spotifyService = api.getService();
}
 
Example #2
Source File: SpotifyManagerImpl.java    From mirror with Apache License 2.0 5 votes vote down vote up
private SpotifyService createSpotifyService(String accessToken) {
    return new RestAdapter.Builder()
            .setEndpoint(SpotifyApi.SPOTIFY_WEB_API_ENDPOINT)
            .setRequestInterceptor(r -> r.addHeader("Authorization", "Bearer " + accessToken))
            .build()
            .create(SpotifyService.class);
}
 
Example #3
Source File: MainActivity.java    From android-web-api-sample with Apache License 2.0 5 votes vote down vote up
@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;
}
 
Example #4
Source File: SearchPresenter.java    From spotify-web-api-android with MIT License 5 votes vote down vote up
@Override
public void init(String accessToken) {
    logMessage("Api Client created");
    SpotifyApi spotifyApi = new SpotifyApi();

    if (accessToken != null) {
        spotifyApi.setAccessToken(accessToken);
    } else {
        logError("No valid access token");
    }

    mSearchPager = new SearchPager(spotifyApi.getService());

    mContext.bindService(PlayerService.getIntent(mContext), mServiceConnection, Activity.BIND_AUTO_CREATE);
}