This library does not handle storing the token. This will avoid having to switch to the Spotify app for establishing the connection. On iOS you can store the token that you get from getAccessToken(.) and then pass it to connectToSpotifyRemote(.) during the next session. You should not persist this token, nor supply a different token, because the refresh token is only set interally by getAccessToken or connectToSpotifyRemote. This will avoid having to send user through two Spotify OAuth prompts. On Web you can use the token that you get from getAccessToken(.) and then pass it to connectToSpotifyRemote(.). For more information on scopes you can refer to Spotify Authorization Scopes Guide var accessToken = await SpotifySdk.getAccessToken(clientId: "", redirectUrl: "", scope: "app-remote-control,user-modify-playback-state,playlist-read-private") You can specify multiple scopes by separating them with a comma "," as shown below. If you want to use the web api as well you have to use this method to get the access token. await nnectToSpotifyRemote(clientId: "", redirectUrl: "") In both of these methods you need the client id, which you will find in the Spotify developer dashboard and the redirect url you set there for that specific client. To connect to the Spotify app you can call connectToSpotifyRemote(.) or getAccessToken(.). import 'package:spotify_sdk/spotify_sdk.dart' To start using this package first import it in your Dart file. You need Spotify Premium to access the Web SDK. Window.onSpotifyWebPlaybackSDKReady = (evt) => Optionally add this to your Flutter app web/index.html to avoid a Javascript TypeError: r._extends is not a function error in development mode.Please wait while we authenticate Spotify. Paste the following onto the webpage, which you linked to in your redirect URL. You need to provide a redirect URL which points to a dedicated page on a website you own. Register your app in the spotify developer portal. You also need to register your Bundle ID as well as a Redirect URI.įollow the instructions in the section Setup the iOS SDK of Spotify iOS SDK Quick Start. In the android root folder find adle file, open it and add the following line at the top of the file:.In the android root folder create a single folder for spotify-app-remote, place the corresponding aar file and create an empty adle file, like on the screenshot below:Ĭontent of the spotify-app-remote/adle file:Īrtifacts.add("default", file('spotify-app-remote-release-x.x.x.aar')) Open the android folder of your flutter project as an Android Studio project Since Android Studio 4.2 you need to manually perform these steps in order to add. Installation instructions for Android Studio 4.2+ See the Spotify Android SDK Quick Start for detailed information. Here you need the spotify-app-remote-*.aar.Īfter you are all setup you need to add the SDKs *.aar file to your Android Project as Module. download the current Spotify Android SDK.You also need to create a sha-1 fingerprint and add this and your package name to the app settings on the dashboard as well as a redirect url. Register your app in the spotify developer portal.The auth library is needed to get the access token to work with the web api.įrom the Spotify Android SDK Quick Start. This package is using both the spotify-app-remote sdk and spotify-auth library. To use this plugin, add spotify_sdk as a dependency in your pubspec.yaml file like this dependencies: Since it wraps the native SDKs it has the same features and limitations. This is a flutter package that wraps the native iOS and Android Spotify "remote" SDKs as well as the Spotify Web Playback SDK for web.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |