public final class Config extends Object
Modifier and Type | Class and Description |
---|---|
static class |
Config.DeviceType
The SDK represents device types as raw integers, but rather than dealing with an
enum an abstract class is used, as we are missing some intermediate values and
require a bit more granularity here than an enum can offer.
|
Modifier and Type | Field and Description |
---|---|
String |
brandName
Device's brand name as stored in
android.os.Build.MANUFACTURER |
int |
cacheAgeLimitInSeconds
The maximum age for any individual file stored in the cache.
|
String |
cachePath
The location where cached files will be stored.
|
int |
cacheSizeLimitInMegabytes
The maximum size allowed for all files stored in the cache.
|
String |
clientId
A client ID that the app is using.
|
String |
displayName
Device's display name.
|
static String |
IN_FIELD_SEPARATOR |
String |
modelName
Device's model name as stored in
android.os.Build.MODEL . |
String |
oauthToken
Authorization token.
|
String |
osVersion
Device's OS version and supported ABI as stored in
android.os.Build.VERSIONS.RELEASE
and Build.SUPPORTED_ABIS |
String |
uniqueId
Unique ID for the device.
|
Constructor and Description |
---|
Config(Context context,
String oauthToken,
String clientId)
Create a new Config object used for initializing the global
SpotifyPlayer instance. |
Config(Context context,
String oauthToken,
String clientId,
Config.DeviceType deviceType)
Create a new Config object used for initializing the global
SpotifyPlayer instance. |
Modifier and Type | Method and Description |
---|---|
boolean |
shouldUseCache()
Check if disk cache is turned on.
|
void |
useCache(boolean useCache)
Use disk cache.
|
public static final String IN_FIELD_SEPARATOR
public final String oauthToken
public final String uniqueId
public final String clientId
public String displayName
android:label
field in the <application>
element in AndroidManifest.xml
file.
public final String brandName
android.os.Build.MANUFACTURER
public final String modelName
android.os.Build.MODEL
.public final String osVersion
android.os.Build.VERSIONS.RELEASE
and Build.SUPPORTED_ABIS
public final String cachePath
public final int cacheSizeLimitInMegabytes
public final int cacheAgeLimitInSeconds
public Config(Context context, String oauthToken, String clientId)
SpotifyPlayer
instance. Note that the UNKNOWN device
type will be used here.context
- Android contextoauthToken
- Authorization tokenclientId
- Client ID the application is usingpublic Config(Context context, String oauthToken, String clientId, Config.DeviceType deviceType)
SpotifyPlayer
instance.context
- Android contextoauthToken
- Authorization tokenclientId
- Client ID the application is usingdeviceType
- Device typeIllegalArgumentException
- If invalid client ID was passed to the constructor.public void useCache(boolean useCache)
useCache
- If true disk cache will be used,
if false played songs will not be cached.public boolean shouldUseCache()