Use this library to add Spotfy to your project, only in a few minutes !
Top Level Gradle :
allprojects {
repositories {
maven {
url "http://dl.bintray.com/joxad/maven"
}
}
}
Project's build.gradle
dependencies {
compile 'com.github.joxad:android-easy-spotify:$version'
}
In whatever class with Context (better in your first launched Activity class)
new SpotifyManager.Builder()
.setContext(this)
.setApiCallback(getString(R.string.api_spotify_callback))
.setApiKey(getString(R.string.api_spotify_id))
.setScope(new String[]{"user-read-private", "streaming"})
.setConnectionType(AuthenticationResponse.Type.CODE)
.build();
SpotifyManager.loginWithActivity(new SpotifyManager.OAuthListener() {
@Override
public void onReceived(String code) {
Log.d(TAG, code);
}
@Override
public void onError(String error) {
Log.d(TAG, error);
}
});
SpotifyManager.loginWithBrowser(new SpotifyManager.OAuthListener() {
@Override
public void onReceived(String code) {
Log.d(TAG, code);
}
@Override
public void onError(String error) {
Log.d(TAG, error);
}
});