Class SpotifyNativeAuthUtil


  • public class SpotifyNativeAuthUtil
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      SpotifyNativeAuthUtil​(android.app.Activity contextActivity, AuthorizationRequest request, com.spotify.sdk.android.auth.app.Sha1HashUtil sha1HashUtil)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static android.content.Intent createAuthActivityIntent​(android.content.Context context)
      Creates an intent that will launch the auth flow on the currently installed Spotify application
      static int getSpotifyAppVersionCode​(android.content.Context context)
      Get the version code of the installed Spotify app
      static boolean isSpotifyInstalled​(android.content.Context context)
      Check if a version of the Spotify main application is installed
      static boolean isSpotifyVersionAtLeast​(android.content.Context context, int minVersionCode)
      Check if Spotify app version meets minimum requirement
      boolean startAuthActivity()  
      void stopAuthActivity()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SpotifyNativeAuthUtil

        public SpotifyNativeAuthUtil​(@NonNull
                                     android.app.Activity contextActivity,
                                     @NonNull
                                     AuthorizationRequest request,
                                     @NonNull
                                     com.spotify.sdk.android.auth.app.Sha1HashUtil sha1HashUtil)
    • Method Detail

      • startAuthActivity

        public boolean startAuthActivity()
      • createAuthActivityIntent

        @Nullable
        public static android.content.Intent createAuthActivityIntent​(@NonNull
                                                                      android.content.Context context)
        Creates an intent that will launch the auth flow on the currently installed Spotify application
        Parameters:
        context - The context of the caller
        Returns:
        The auth Intent or null if the Spotify application couldn't be found
      • isSpotifyInstalled

        public static boolean isSpotifyInstalled​(@NonNull
                                                 android.content.Context context)
        Check if a version of the Spotify main application is installed
        Parameters:
        context - The context of the caller, used to check if the app is installed
        Returns:
        True if a Spotify app is installed, false otherwise
      • getSpotifyAppVersionCode

        public static int getSpotifyAppVersionCode​(@NonNull
                                                   android.content.Context context)
        Get the version code of the installed Spotify app
        Parameters:
        context - The context of the caller, used to check package info
        Returns:
        Version code of Spotify app, or -1 if not installed or signature validation fails
      • isSpotifyVersionAtLeast

        public static boolean isSpotifyVersionAtLeast​(@NonNull
                                                      android.content.Context context,
                                                      int minVersionCode)
        Check if Spotify app version meets minimum requirement
        Parameters:
        context - The context of the caller, used to check package info
        minVersionCode - Minimum required version code
        Returns:
        true if installed version >= minVersionCode, false otherwise
      • stopAuthActivity

        public void stopAuthActivity()