(Beta) The Spotify Android SDK makes it easy to add audio streaming, user authentication and other Spotify features to Android apps.
About the Android SDK
The Spotify Android SDK makes it easy to add Spotify functionality to your Android app. The SDK contains two small footprint binary libraries packaged as Android archives (AAR):
- Spotify Authentication Library. This library provides a way to obtain OAuth access tokens that can subsequently be used to play music or used in calls to the Spotify Web API.
- Spotify Player Library. This library contains classes for audio playback and stream management. It takes care of all negotiation with backend Spotify services, including digital rights management and decoding.
The Android SDK does not currently have functions for metadata lookup or playlist management. For that, you need to use the Web API, with which you can communicate after receiving an OAuth token from the SDK. You can use a Spotify Web API Android wrapper.
Downloading the SDK
The Android SDK is available for download from its home on GitHub:
Tutorial and Examples
We provide a beginner’s tutorial to help you set up your build environment and get started with the Android SDK. It leads you through the creation of a simple app that connects to the Spotify service and plays a track.
Within the download package you will also find some example code to help get you started.
The download package includes comprehensive documentation of all API classes. Because Android libraries cannot include Javadoc files, HTML documentation is shipped within the download zipfile. You can also read the documentation online.
Authentication and Authorization
To authenticate an application user, to get the user’s authorization to access private data, and to stream music, your application will first need to connect to the Spotify Accounts Service and retrieve a valid OAuth access token. The Android SDK’s Authentication Library provides the classes you need to do this.
You can perform the authentication/authorization in either a native WebView or in a browser window. Our Android SDK Authentication Guide provides instructions and examples for both methods.
The authentication of the user and the authorization of scopes follows exactly the same path as user authentication and authorization for the Spotify Web API; for detailed information, see the Web API Authorization Guide.
Feel free to experiment with the Android SDK beta version and to report problems through the public issue tracker on GitHub.
Please also note that streaming of full-length tracks is only available to your users who have a Spotify Premium subscription.