This is a sample app using the awesome Spotify-Web-Api-Kotlin library to interact with the Spotify API. This app also implements the user login flow via PKCE and an anonymous login using the client credentials flow.
Because I won't provide the internet with my Spotify Client ID and Client Secret, you need to enter them yourself. Follow the steps below to get the required credentials and eventually get a working app:
- Create Spotify Developer account at the Spotify Developer Dashboard
- Create app in the Spotify Developer dashboard
- Copy Client ID and Client Secret to the build.gradle in the app folder (replace the text "REPLACE_THIS" with the corresponding value)
- Add redirect uri "spotifyplayground://spotify" to your app at the Spotify developer website (edit settings > redirect uri)
- Add package name "dev.nielsg.spotifyplayground" to your app at the Spotify developer website. Make sure to also add your keystore hash, which can be retrieved from either your keystore, or generated from your computer's keystore (Windows: keytool -list -v -keystore c:\users\YOUR_USER_NAME.android\debug.keystore -alias androiddebugkey -storepass android -keypass android)
- Spotify should now work in your app :)