SpotifyAppRemoteBinding 1.0.0

dotnet add package SpotifyAppRemoteBinding --version 1.0.0
                    
NuGet\Install-Package SpotifyAppRemoteBinding -Version 1.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SpotifyAppRemoteBinding" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SpotifyAppRemoteBinding" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="SpotifyAppRemoteBinding" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add SpotifyAppRemoteBinding --version 1.0.0
                    
#r "nuget: SpotifyAppRemoteBinding, 1.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package SpotifyAppRemoteBinding@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=SpotifyAppRemoteBinding&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=SpotifyAppRemoteBinding&version=1.0.0
                    
Install as a Cake Tool

SpotifyAppRemoteBinding

Android Java bindings for the Spotify Android App Remote SDK This is just a binding for the official SDK, so only the properties throwing errors were changed.

Set Up

In order to use the player, you must first authenticate. Authenticating is simple, in your MainActivity.cs create a new override

[Activity(Theme = "@style/Maui.SplashTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.UiMode | ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize | ConfigChanges.Density)]
public class MainActivity : MauiAppCompatActivity
{
    protected override void OnCreate(Bundle? savedInstanceState)
    {
        base.OnCreate(savedInstanceState);

        SpotifyAppRemote remote; // REALLY IMPORTANT, DO NOT LEAVE THIS OUT
        ConnectionParams connectionParams = new ConnectionParams.Builder("clientId").SetRedirectUri("http://localhost:5543").ShowAuthView(true).Build();
        SpotifyAppRemote.Connect(this, connectionParams, new ConnectionListener()); // If you're calling this from outside of this function (after the user opens the app), replace `this` with `Platform.CurrentActivity`
    }
}
// The ConnectionListener class used above
public class ConnectionListener : Java.Lang.Object, IConnector.IConnectionListener
    {
        public void OnConnected(SpotifyAppRemote? p0)
        {
            // Conneted successfully, do something with the SpotifyAppRemote
            MainPage.Spotify = p0;
        }

        public void OnFailure(Throwable? p0)
        {
            // Received error, Spotify connection failed
#if ANDROID
            Toast.MakeText(Platform.CurrentActivity, p0.Message, ToastLength.Long).Show();
#endif
        }
    }

Now you have to set up the Spotify app on the developer portal. Create the app, check the Android SDK, and add your redirect URL. The final step is to get your app package fingerprint. The SDK will not show the authentication popup if you do not add this. Find your debug.keystore file in %HOMEPATH%\AppData\Local\Xamarin\Mono for Android Copy the path, then find your Java JDK location, if you do not have Java installed, download it. The default location is C:\Program Files\Java\jdk-xx.x.x\bin Open this location in a terminal or command prompt, then run the command

keytool.exe -list -v -keystore {path to debug.keystore} -alias androiddebugkey -storepass android

This will give you a lot of information, find the SHA1 fingerprint and copy it into your Spotify app under the Android Packages section. And now your app should be able to use the Spotify SDK! This is only for Android at the moment

Product Compatible and additional computed target framework versions.
.NET net8.0-android34.0 is compatible.  net9.0-android was computed.  net10.0-android was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net8.0-android34.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 363 5/28/2024