spotify / android-sdk Goto Github PK
View Code? Open in Web Editor NEWSpotify SDK for Android
Home Page: https://developer.spotify.com/documentation/android/
License: Apache License 2.0
Spotify SDK for Android
Home Page: https://developer.spotify.com/documentation/android/
License: Apache License 2.0
Issue found on 01/10/2018
OS Version: Android Nougat (Android 7.1.1)
Device Model: Coolpad
Scope(s): streaming, user-library-read, and playlist-read
Steps to reproduce:
Calling the following method
private void signInSpotify() {
final AuthenticationRequest request = new AuthenticationRequest.Builder(Constants.SPOTIFY_CLIENT_ID, AuthenticationResponse.Type.TOKEN, Constants.SPOTIFY_REDIRECT_URI)
.setScopes(new String[]{"streaming", "user-library-read","playlist-read"})
.build();
AuthenticationClient.openLoginActivity(parentActivity, 3, request);
}
I've tested 2 different client IDs in the above code and redirect URI with the following format:
my-example-app://callback/
AuthenticationResponse response = AuthenticationClient.getResponse(resultCode, data);
switch (response.getType()) {
case TOKEN:
spofityLoggedIn = true;
CredentialsHandler.setOperationType(MainActivity.this, "UploadingSong");
Clipeo.spotifyAccessToken = response.getAccessToken();
switchFragment(Main.newInstance());
break;
// Auth flow returned an error
case ERROR:
spofityLoggedIn = false;
logMessage("Auth error: " + response.getError());
break;
default:
//MainActivity.spofityLoggedIn = false;
logMessage("Auth error: " + response.getError());
}
Executing the above code always print an error "INVALID_APP_ID" in logcat.
Expected behaviour:
Spotify Authentication allows user to login and returns a success response.
Actual behaviour:
INVALID_APP_ID error is printed when user tries to login in with a Spotify account.
Successful tests:
Galaxy S8 (Android Oreo 8.0) and Google Nexus 7 (Android Nougat 7.1.1).
I want to be able to show a list of tracks that are in the current queue to my user.
Is there any way to achieve this? I cant seem to find anything in the java docs.
Thanks in advance
Issue found on August 9th, 2018
0.4.0
N/A
N/A
The documentation found here lists the dependencies as follows:
dependencies { // your app dependencies compile project(':spotify-app-remote') compile "com.google.code.gson:gson:2.6.1" }
However, it would seem that without including Jackson as a dependency (even if you aren't using it) produces the following compilation error:
Failed to find byte code for com/fasterxml/jackson/databind/ser/std/StdSerializer
I resolved this issue by including the following dependencies:
compile 'com.fasterxml.jackson.core:jackson-core:2.7.3'
compile 'com.fasterxml.jackson.core:jackson-annotations:2.7.3'
compile 'com.fasterxml.jackson.core:jackson-databind:2.7.3'
Does the documentation need to be updates to include these or am I missing something? Thanks!
Issue found on 05/24/2018.
The library connects and starts to play music.
The error Client authentication failed: INVALID_APP_ID
is raised on logcat.
05-24 22:31:21.729 19446-19529/com.galaxia.galaxia W/art: Unable to resolve Lcom/spotify/protocol/types/Roles; annotation class 28
05-24 22:31:21.731 19446-19529/com.galaxia.galaxia W/art: Unable to resolve Lcom/spotify/protocol/types/Roles; annotation class 28
05-24 22:31:21.732 19446-19529/com.galaxia.galaxia W/art: Unable to resolve Lcom/spotify/protocol/types/Roles; annotation class 28
05-24 22:31:21.734 19446-19529/com.galaxia.galaxia W/art: Unable to resolve Lcom/spotify/protocol/types/Roles; annotation class 28
05-24 22:31:28.530 19446-19446/com.galaxia.galaxia D/RemoteServiceIo: Message from Spotify: [3,{"message":"Client authentication failed: INVALID_APP_ID"},"com.spotify.error.client_authentication_failed"]
05-24 22:31:28.557 19446-19446/com.galaxia.galaxia D/RemoteServiceIo: stop remote client
05-24 22:31:28.561 19446-19446/com.galaxia.galaxia E/MyActivity: {"message":"Client authentication failed: INVALID_APP_ID"}
com.spotify.android.appremote.api.error.AuthenticationFailedException: {"message":"Client authentication failed: INVALID_APP_ID"}
at com.spotify.android.appremote.api.LocalConnector.asAppRemoteException(LocalConnector.java:121)
at com.spotify.android.appremote.api.LocalConnector.access$000(LocalConnector.java:36)
at com.spotify.android.appremote.api.LocalConnector$1.onConnectionFailed(LocalConnector.java:108)
at com.spotify.android.appremote.internal.SdkRemoteClientConnector$ConnectionTask.onPostExecute(SdkRemoteClientConnector.java:137)
at com.spotify.android.appremote.internal.SdkRemoteClientConnector$ConnectionTask.onPostExecute(SdkRemoteClientConnector.java:75)
at android.os.AsyncTask.finish(AsyncTask.java:667)
at android.os.AsyncTask.-wrap1(AsyncTask.java)
at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:684)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6165)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:888)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:778)
Caused by: com.spotify.protocol.client.error.RemoteClientException: {"message":"Client authentication failed: INVALID_APP_ID"}
at com.spotify.protocol.client.RemoteWampClient.getRemoteClientException(RemoteWampClient.java:107)
at com.spotify.protocol.client.RemoteWampClient.access$200(RemoteWampClient.java:14)
at com.spotify.protocol.client.RemoteWampClient$1.onAbort(RemoteWampClient.java:36)
at com.spotify.protocol.client.WampRouterImpl.routeAbort(WampRouterImpl.java:110)
at com.spotify.protocol.client.WampRouterImpl.route(WampRouterImpl.java:32)
at com.spotify.protocol.client.AppProtocolCommunicator.onData(AppProtocolCommunicator.java:76)
at com.spotify.android.appremote.internal.RemoteServiceIo.handleMessage(RemoteServiceIo.java:118)
at com.spotify.android.appremote.internal.RemoteServiceIo.access$000(RemoteServiceIo.java:47)
at com.spotify.android.appremote.internal.RemoteServiceIo$IncomingHandler.handleMessage(RemoteServiceIo.java:96)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6165)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:888)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:778)
Issue found on 04/10/2018
Running this:
`
SpotifyAppRemote.CONNECTOR.connect(
getApplication(),
new ConnectionParams.Builder(CLIENT_ID)
.setRedirectUri(REDIRECT_URI)
.showAuthView(showAuthView)
.build(),
new Connector.ConnectionListener() {
@OverRide
public void onConnected(SpotifyAppRemote spotifyAppRemote) {
mSpotifyAppRemote = spotifyAppRemote;
Toast.makeText(getBaseContext(), "onConnected: connected !!!",Toast.LENGTH_LONG).show();
connected();
}
@Override
public void onFailure(Throwable error) {
Toast.makeText(getBaseContext(), "Connection failed: " + error, Toast.LENGTH_LONG).show();
Log.d(TAG, "onFailure: " + error);
}
});
`
To be able to connect.
Getting error:
Message from Spotify: [3,{"message":"Client authentication failed: INVALID_APP_ID"},"com.spotify.error.client_authentication_failed"]
I added the Android Package Name, SHA1 Fingerprint and the redirect uri to the settings
Thanks for your interest in the Spotify App Remote SDK!
If you're submitting a bug, please use the following template.
If your issue is a feature request, please include your use-case so that we have all the necessary info.
Issue found on 09/27/2018.
App should go to login
09-27 14:22:16.332 16062 16062 E AndroidRuntime: Process: com.spotify.sdk.android.authentication.sample, PID: 16062 09-27 14:22:16.332 16062 16062 E AndroidRuntime: java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/customtabs/CustomTabsIntent$Builder; 09-27 14:22:16.332 16062 16062 E AndroidRuntime: at com.spotify.sdk.android.authentication.CustomTabAuthHandler.start(CustomTabAuthHandler.java:69) 09-27 14:22:16.332 16062 16062 E AndroidRuntime: at com.spotify.sdk.android.authentication.AuthenticationClient.tryAuthenticationHandler(AuthenticationClient.java:505) 09-27 14:22:16.332 16062 16062 E AndroidRuntime: at com.spotify.sdk.android.authentication.AuthenticationClient.authenticate(AuthenticationClient.java:430) 09-27 14:22:16.332 16062 16062 E AndroidRuntime: at com.spotify.sdk.android.authentication.LoginActivity.onCreate(LoginActivity.java:112) 09-27 14:22:16.332 16062 16062 E AndroidRuntime: at android.app.Activity.performCreate(Activity.java:6955) 09-27 14:22:16.332 16062 16062 E AndroidRuntime: at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1126) 09-27 14:22:16.332 16062 16062 E AndroidRuntime: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2927) 09-27 14:22:16.332 16062 16062 E AndroidRuntime: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3045) 09-27 14:22:16.332 16062 16062 E AndroidRuntime: at android.app.ActivityThread.-wrap14(ActivityThread.java) 09-27 14:22:16.332 16062 16062 E AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1642) 09-27 14:22:16.332 16062 16062 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:102) 09-27 14:22:16.332 16062 16062 E AndroidRuntime: at android.os.Looper.loop(Looper.java:154) 09-27 14:22:16.332 16062 16062 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:6776) 09-27 14:22:16.332 16062 16062 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method) 09-27 14:22:16.332 16062 16062 E AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1496) 09-27 14:22:16.332 16062 16062 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1386) 09-27 14:22:16.332 16062 16062 E AndroidRuntime: Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.customtabs.CustomTabsIntent$Builder"
I just added
implementation "com.android.support:customtabs:$supportLibVersion"
in sample's build.gradle dependencies (https://github.com/spotify/android-sdk/blob/master/auth-sample/build.gradle)
Thanks for your interest in the Spotify App Remote SDK!
If you're submitting a bug, please use the following template.
If your issue is a feature request, please include your use-case so that we have all the necessary info.
I have Explicit content turned off on my account and over the course of the last couple of weeks I have heard ads that contain offensive language. I would much rather that this issue does not continue on my account. The Metal AF ad is the one that is causing the most issues.
Not all playable items pass validation.
Playlist. Some times i get playlist with used id. Valid playlist looks like this spotify:user:spotify:playlist:37i9dQZF1DWXqpDKK4ed9O
here user is spotify and this means it is public. But sometime I get spotify:playlist:37i9dQZF1DWXqpDKK4ed9O
with no user. I had this issue with ""90s Love Songs"" but later it got fixed after 2-3 days. It was pretty random
Tracks. A valid track uri should look like this spotify:track:0DiWol3AO6WpXZgp0goxAV
.
BUT! It actually looks like this spotify:station:track:0DiWol3AO6WpXZgp0goxAV
. It has ""station"" word in there. Why?"
Thanks for your interest in the Spotify App Remote SDK!
If you're submitting a bug, please use the following template.
If your issue is a feature request, please include your use-case so that we have all the necessary info.
Issue found on november.
What I want is, when I go to an album from an artist or from Search, I of course want to see the content.
SpotifyAppRemote.CONNECTOR.connect()
and play URI with SpotifyAppRemote.play()
SDK should keep logcat fairly clean
Logcat is filled with messages like these:
W/zygote64: Unable to resolve Lcom/spotify/protocol/types/HelloDetails; annotation class 3177
W/zygote64: Unable to resolve Lcom/spotify/protocol/types/HelloDetails; annotation class 3180
W/zygote64: Unable to resolve Lcom/spotify/protocol/types/HelloDetails; annotation class 3180
W/zygote64: Unable to resolve Lcom/spotify/protocol/types/HelloDetails; annotation class 3180
W/zygote64: Unable to resolve Lcom/spotify/protocol/types/HelloDetails; annotation class 3180
I/chatty: uid=10222(com.matejdro.taskerspotifystarter) AsyncTask #1 identical 3 lines
W/zygote64: Unable to resolve Lcom/spotify/protocol/types/HelloDetails; annotation class 3180
W/zygote64: Unable to resolve Lcom/spotify/protocol/types/Info; annotation class 3177
W/zygote64: Unable to resolve Lcom/spotify/protocol/types/Info; annotation class 3180
I/chatty: uid=10222(com.matejdro.taskerspotifystarter) AsyncTask #1 identical 3 lines
W/zygote64: Unable to resolve Lcom/spotify/protocol/types/Info; annotation class 3180
W/zygote64: Unable to resolve Lcom/spotify/protocol/types/Info; annotation class 3180
W/zygote64: Unable to resolve Lcom/spotify/protocol/types/Info; annotation class 3180
W/zygote64: Unable to resolve Lcom/spotify/protocol/types/Info; annotation class 3180
I/chatty: uid=10222(com.matejdro.taskerspotifystarter) AsyncTask #1 identical 3 lines
W/zygote64: Unable to resolve Lcom/spotify/protocol/types/Info; annotation class 3180
W/zygote64: Unable to resolve Lcom/spotify/protocol/types/Info; annotation class 3180
I/chatty: uid=10222(com.matejdro.taskerspotifystarter) AsyncTask #1 identical 1 line
W/zygote64: Unable to resolve Lcom/spotify/protocol/types/Info; annotation class 3180
W/zygote64: Unable to resolve Lcom/spotify/protocol/types/Info; annotation class 3180
I/chatty: uid=10222(com.matejdro.taskerspotifystarter) AsyncTask #1 identical 5 lines
W/zygote64: Unable to resolve Lcom/spotify/protocol/types/Info; annotation class 3180
W/zygote64: Unable to resolve Lcom/spotify/protocol/types/Info; annotation class 3180
W/zygote64: Unable to resolve Lcom/spotify/protocol/types/Info; annotation class 3180
Unable to resolve Lcom/spotify/protocol/types/HelloDetails; annotation class 3180
W/zygote64: Unable to resolve Lcom/spotify/protocol/types/HelloDetails; annotation class 3180
W/zygote64: Unable to resolve Lcom/spotify/protocol/types/Roles; annotation class 3177
W/zygote64: Unable to resolve Lcom/spotify/protocol/types/Roles; annotation class 3180
I/chatty: uid=10222(com.matejdro.taskerspotifystarter) AsyncTask #1 identical 2 lines
W/zygote64: Unable to resolve Lcom/spotify/protocol/types/Roles; annotation class 3180
W/zygote64: Unable to resolve Lcom/spotify/protocol/types/Roles; annotation class 3180
W/zygote64: Unable to resolve Lcom/spotify/protocol/types/Roles; annotation class 3180
I/chatty: uid=10222(com.matejdro.taskerspotifystarter) AsyncTask #1 identical 1 line
W/zygote64: Unable to resolve Lcom/spotify/protocol/types/Roles; annotation class 3180
I'm trying to replicate the official documentation guide to make broadcast types work, but no success.
I'm trying since last week.
OS Version: API 27 (Android Oreo)
Spotify Version: 8.4.70.666
Expected behaviour:
As the guide suggested i would be able to identify changes on spotify songs to work with tracks and stuff to put on my application (Car Dashboard), but no success. I can make it work by the internet, via api, but without success with the broadcast status.
Actual behaviour:
It seems not be able to identify the changes. Bellow, has my broadcast class and my Manifest file:
Class_
package phpmysql.app.ffro3.php_mysql;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.widget.Toast;
public class MyBroadcastReceiver extends BroadcastReceiver{
static final class BroadcastTypes {
static final String SPOTIFY_PACKAGE = "com.spotify.music";
static final String PLAYBACK_STATE_CHANGED = SPOTIFY_PACKAGE + ".playbackstatechanged";
static final String QUEUE_CHANGED = SPOTIFY_PACKAGE + ".queuechanged";
static final String METADATA_CHANGED = SPOTIFY_PACKAGE + ".metadatachanged";
}
@Override
public void onReceive(Context context, Intent intent) {
// This is sent with all broadcasts, regardless of type. The value is taken from
// System.currentTimeMillis(), which you can compare to in order to determine how
// old the event is.
Toast toast = Toast.makeText(context, "Broadcast funcionando corretamente", Toast.LENGTH_SHORT);
toast.show();
long timeSentInMs = intent.getLongExtra("timeSent", 0L);
Toast.makeText(context, String.valueOf(timeSentInMs), Toast.LENGTH_LONG).show();
String action = intent.getAction();
if (action.equals(BroadcastTypes.METADATA_CHANGED)) {
String trackId = intent.getStringExtra("id");
String artistName = intent.getStringExtra("artist");
String albumName = intent.getStringExtra("album");
String trackName = intent.getStringExtra("track");
int trackLengthInSec = intent.getIntExtra("length", 0);
// Do something with extracted information...
Toast toasty = Toast.makeText(context, "Broadcast ouviu a mudanca corretamente", Toast.LENGTH_SHORT);
toasty.show();
} else if (action.equals(BroadcastTypes.PLAYBACK_STATE_CHANGED)) {
boolean playing = intent.getBooleanExtra("playing", false);
int positionInMs = intent.getIntExtra("playbackPosition", 0);
// Do something with extracted information
} else if (action.equals(BroadcastTypes.QUEUE_CHANGED)) {
// Sent only as a notification, your app may want to respond accordingly.
}
}
}
AndroidManifest.xml_
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.BLUETOOTH"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE"/>
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="Corsadroid"
android:roundIcon="@mipmap/ic_launcher"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<meta-data
android:name="com.google.android.gms.car.application"
android:resource="@xml/automotive_app_desc" />
<activity
android:name=".Home_Activity"
android:label="@string/title_activity_home_"
android:windowSoftInputMode="adjustPan" />
<activity
android:name=".ScrollingActivity"
android:label="@string/title_activity_scrolling" />
<activity android:name=".itemUsuario" />
<activity android:name=".User_details" />
<activity android:name=".CarHome" />
<activity android:name=".Playlist" />
<activity android:name=".nowPlaying" />
<receiver android:name=".BroadcastMessage">
<intent-filter>
<action android:name="android.intent.action.AIRPLANE_MODE" />
</intent-filter>
</receiver>
</application>
I'm missing something? The Broadcast Status isn't being sent by spotify app in this version?
Thanks
I'm trying to login an Spotify App into my Android app but i can't find any method for login with Client Credentials Flow.
I've searched in the SDK and in the WebAPI Libs and nothing seems to include Client Credentials Flow
Some help?
Hi,
Is there a way of getting raw waveform from new spotify remote SDK like the 2014 SDK had a player from which raw waveform can be extracted? I have gone through the SDK and couldn't find it.
Is there any chance that the old 2014 spotify-player will be deprecated or will stop providing raw waveforms to its client?
x
I have a running app integrated with Spotify Authentication flow via web login so I already have a token. Docs says I can use this token to user app remote sdk but I don't get how.
ConnectionParams
doesn't seem to have a way to set the token. How should I give this params my token?
i think i forgot to implement auth
I'm finding a way to clear all songs from queue but couldn't find it. Can we have this feature in the future? Thank you.
I receive this error upon trying to compile a SampleApp.
Here's my dependencies
implementation project(':spotify-app-remote-release-0.4.0')
implementation "com.google.code.gson:gson:2.8.5"
Here's my mainactivity onStart (np other code)
```
@OverRide
protected void onStart() {
super.onStart();
// Set the connection parameters
ConnectionParams connectionParams =
new ConnectionParams.Builder(CLIENT_ID)
.setRedirectUri(REDIRECT_URI)
.showAuthView(true)
.build();
SpotifyAppRemote.CONNECTOR.connect(this, connectionParams,
new Connector.ConnectionListener() {
@Override
public void onConnected(SpotifyAppRemote spotifyAppRemote) {
mSpotifyAppRemote = spotifyAppRemote;
Log.d("MainActivity", "Connected! Yay!");
// Now you can start interacting with App Remote
connected();
}
@Override
public void onFailure(Throwable throwable) {
Log.e("MainActivity", throwable.getMessage(), throwable);
// Something went wrong when attempting to connect! Handle errors here
}
});
// We will start writing our code here.
}
IDeas anyone?
I can't find how to get the track length anywhere in the library... I'd assume it'd be with PlayerContext but it's not.
Is there a way we can detect when a song ends?
I'm trying to create some sort of custom queue, as I couldn't find any way to modify the queue, any pointers as to how this can be achieved?
Thanks
Issue found on 2018-11-14.
App connects to Spotify player and receives information about player state.
App connects 5-10 % of the time, the rest of the time it gets an error message with the message "Client authentication failed: INVALID_CLIENT". I'm using the client id I've received on the developer dashboard, and 'com.lordoscar.spotimote://callback' as redirect uri. I've also registered the fingerprint on the developer dashboard, so that shouldnt be the issue either.
E/MainActivity: {"message":"Client authentication failed: INVALID_CLIENT"} com.spotify.android.appremote.api.error.AuthenticationFailedException: {"message":"Client authentication failed: INVALID_CLIENT"} at com.spotify.android.appremote.api.LocalConnector.asAppRemoteException(LocalConnector.java:126) at com.spotify.android.appremote.api.LocalConnector.access$000(LocalConnector.java:38) at com.spotify.android.appremote.api.LocalConnector$1.onConnectionFailed(LocalConnector.java:113) at com.spotify.android.appremote.internal.SdkRemoteClientConnector$ConnectionTask.onPostExecute(SdkRemoteClientConnector.java:152) at com.spotify.android.appremote.internal.SdkRemoteClientConnector$ConnectionTask.onPostExecute(SdkRemoteClientConnector.java:86) at android.os.AsyncTask.finish(AsyncTask.java:695) at android.os.AsyncTask.-wrap1(Unknown Source:0) at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:712) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:164) at android.app.ActivityThread.main(ActivityThread.java:6753) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:482) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807) Caused by: com.spotify.protocol.client.error.RemoteClientException: {"message":"Client authentication failed: INVALID_CLIENT"} at com.spotify.protocol.client.RemoteWampClient.getRemoteClientException(RemoteWampClient.java:111) at com.spotify.protocol.client.RemoteWampClient.access$200(RemoteWampClient.java:14) at com.spotify.protocol.client.RemoteWampClient$1.onAbort(RemoteWampClient.java:38) at com.spotify.protocol.client.WampRouterImpl.routeAbort(WampRouterImpl.java:110) at com.spotify.protocol.client.WampRouterImpl.route(WampRouterImpl.java:32) at com.spotify.protocol.client.AppProtocolCommunicator.onData(AppProtocolCommunicator.java:76) at com.spotify.android.appremote.internal.RemoteServiceIo.handleMessage(RemoteServiceIo.java:115) at com.spotify.android.appremote.internal.RemoteServiceIo.access$000(RemoteServiceIo.java:50) at com.spotify.android.appremote.internal.RemoteServiceIo$IncomingHandler.handleMessage(RemoteServiceIo.java:93)
Issue found on Sep 26 2018.
This is not a bug, it's more a feature request - but perhaps this is already possible and I just didn't see how to do it.
I want to store the current position in a track to be able to lateron resume at the same position. Getting information about position and current track is easy, the same is resuming.
The problem which I am currently are unable to solve is that I want the context of the track to stay the same so that the subsequent track played is the same as it would have been when playing without interruption.
Is there any way to do this with the current SDK?
I am using version 0.4.0 on Android 8 with the most recent version of the Spotify app for Android.
Thanks for your help!
I have the proper client id. What gives?
SpotifyAppRemote.CONNECTOR.connect(this, connectionParams, new Connector.ConnectionListener() { @Override public void onConnected(SpotifyAppRemote spotifyAppRemote) { mSpotifyAppRemote = spotifyAppRemote; Log.d("MainActivity", "Connected! Yay!"); // Now you can start interacting with App Remote connected(); } @Override public void onFailure(Throwable throwable) { Log.e("MainActivity", throwable.getMessage(), throwable); // Something went wrong when attempting to connect! Handle errors here } });
The onFailureThrowable is called.
AuthenticationRequest.Builder builderx =
new AuthenticationRequest.Builder(clientId, AuthenticationResponse.Type.TOKEN, REDIRECT_URI);
builderx.setScopes(new String[]{"streaming"});
AuthenticationRequest request = builderx.build();
AuthenticationClient.openLoginActivity(this, REQUEST_CODE, request);
This gets me this error: AUTHENTICATION_SERVICE_UNKNOWN_ERROR
EDIT: Never mind
At the moment app needs online internet connection to connect to the Spotify. This is pretty limiting, if user is, for example in a tunnel or in other low-signal zone or abroad in roaming mode.
Yes, controlling app could connect once and keep connection established for ever, but that would waste ram unnecessarily since app would need to have constantly running background service.
So my proposal: once app gets authenticated once, cache its credentials locally on the user's device, and periodically renew that cache (similar to how global offline mode works for Spotify where you can listen to offline for 30 days, but then must come online once for auth check). That way all controllers can securely connect in all environments.
In the readme you write:
While certain playback controls work offline and playback can happen offline for offlined content, apps cannot connect and start communicating with Spotify unless there is an internet connection
What does that mean?
I am thinking about making a Spotify alarm clock that must work offline. What would that mean for the apps possible offline capabilities?
Issue found on 4/19/2018.
spotifyAppRemote.getImagesApi().getImage(track.imageUri)
Image should load and be returned to the result callback. Image URI appears to be correctly provided by track.
Callback error is supplied, giving very little info to what went wrong with loading the image.
com.spotify.protocol.client.error.RemoteClientException: {"message":"Failed to load image."}
at com.spotify.protocol.client.RemoteWampClient.getRemoteClientException(RemoteWampClient.java:107)
at com.spotify.protocol.client.RemoteWampClient.access$200(RemoteWampClient.java:14)
at com.spotify.protocol.client.RemoteWampClient$1.onError(RemoteWampClient.java:85)
at com.spotify.protocol.client.WampRouterImpl.routeError(WampRouterImpl.java:85)
at com.spotify.protocol.client.WampRouterImpl.route(WampRouterImpl.java:52)
at com.spotify.protocol.client.AppProtocolCommunicator.onData(AppProtocolCommunicator.java:76)
at com.spotify.android.appremote.internal.RemoteServiceIo.handleMessage(RemoteServiceIo.java:118)
at com.spotify.android.appremote.internal.RemoteServiceIo.access$000(RemoteServiceIo.java:47)
at com.spotify.android.appremote.internal.RemoteServiceIo$IncomingHandler.handleMessage(RemoteServiceIo.java:96)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6938)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)
Pre-conditions: App is appropriately connected to Spotify via the SDK, and music is currently playing.
According to Spotify documentation, we should receive SpotifyConnectionTerminatedException on Interface Connector.ConnectionListener, but the onFailure method is not being called.
When we manually kill Spotify app, we are not getting any callback from the SDK about this.
Issue found on DATE.
Nov 10,2018
"playlist-read-collaborative","user-library-read","app-remote-control","user-read-playback-state","user-top-read"
1)use PlayerApi to play songs from album with uri "spotify:album:{album id}"
2)Play normally.
3)use PlayerApi to play the track directly with uri "spotify:track:{track id}"
4)Track not play at all
PlayerApi able to play both the track directly and the album playlist.
The track not starting,but album play normally.
Most Spotify SDK/API endpoints have been premium only.
Any chance this SDK could also support non premium users? It's a hassle to write an alternate implementation with hacky intents and notification listeners for non premium users...
There's no need for additional methods to check if an user is a premium user or non premium user exceptions, I don't mind checking the subscription of an user with the web API. I just would like to be able to keep track of the playback state and start shuffle playback of a certain playback context. Obviously there are some edge cases like tablets though.
If the player is playing a playlist or album is there a way to get all the tracks in it? I can't see one, it would be very useful in order to create a UI to show the next songs that will be played.
I know this is a place for issues to be raised for bugs in SDK. However, being not able to find any solution, is there any such feature on SDK which can be found in Settings of Spotify Apps. If not, this will be a good addition while obtaining raw PCM.
Hi. I'm trying to use Web API with a an android wrapper class that uses retrofit.
Unless of course, it's possible to create playlists using the given android-sdk.
My question is this:
SpotifyAppRemote.CONNECTOR.connect(this, connectionParams,
new Connector.ConnectionListener() {
@Override
public void onConnected(SpotifyAppRemote spotifyAppRemote) {
mSpotifyAppRemote = spotifyAppRemote;
Log.d("TESTX", "Connected! Yay!");
}
@Override
public void onFailure(Throwable throwable) {
Log.e("TESTX", "ERROR: " + throwable.getMessage(), throwable);
// Something went wrong when attempting to connect! Handle errors here
}
}
);
How do I access the auth_token now that I've been "Connected! Yay!" ??? I need it for the web api.
Hi there! This error only occures sometimes, i am very confused. I dont remember this error, it must be new.. i dont know.. maybe with the last spotify updates?
"app-remote-control",
"playlist-read-private",
"playlist-modify-private",
"playlist-modify-public",
"user-read-private",
"streaming",
"user-top-read",
"user-modify-playback-state",
"user-read-currently-playing",
"user-read-playback-state"
ONLY SOMETIMES:
Thank you very much for helping me
I'am using the remote sdk to try to add a track to the current queue playback but nothing happens.
Tested in different devices:
My code is the following:
ConnectionParams connectionParams =
new ConnectionParams.Builder(CLIENT_ID)
.setRedirectUri(REDIRECT_URI)
.showAuthView(true)
.build();
SpotifyAppRemote.setDebugMode(true);
SpotifyAppRemote.CONNECTOR.connect(this, connectionParams,
new Connector.ConnectionListener() {
public void onConnected(SpotifyAppRemote spotifyAppRemote) {
mSpotifyAppRemote = spotifyAppRemote;
}
});
btnQueue.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Log.d(TAG, "Queuing track in progress...");
CallResult<Empty> result = mSpotifyAppRemote.getPlayerApi().queue("spotify:track:1YmVP8YHML5GmTz2olx7nA");
result.setResultCallback(new CallResult.ResultCallback<Empty>() {
@Override
public void onResult(Empty empty) {
Log.d(TAG, "Track queued");
}
});
result.setErrorCallback(new ErrorCallback() {
@Override
public void onError(Throwable throwable) {
Log.e(TAG, "Error queueing track");
}
});
}
});
When I click the button "queue a track", result callback is called, "Track queued" printed on log, but the track isn't in the queue playback.
The steps I'am following are the next:
My app can pause and resume the track playing in the computer without problems but not queuing a track. The queue functionality is a great feature and I wish I'll can used it in my app.
Thanks for your interest in the Spotify App Remote SDK!
If you're submitting a bug, please use the following template.
If your issue is a feature request, please include your use-case so that we have all the necessary info.
Issue found on DATE. 5/31/2018
AuthenticationRequest.Builder builder = new AuthenticationRequest.Builder(CLIENT_ID, AuthenticationResponse.Type.CODE, REDIRECT_URI);
builder.setScopes(new String[]{"app-remote-control"});
AuthenticationRequest request = builder.build();
Intent intent = LoginActivity.getAuthIntent(context, request);
startActivityForResult(intent, REQUEST_CODE);
throwing below exception :
com.spotify.android.appremote.api.error.AuthenticationFailedException: {"message":"Client authentication failed: AUTHENTICATION_SERVICE_UNAVAILABLE"}
at com.spotify.android.appremote.api.LocalConnector.asAppRemoteException(LocalConnector.java:121)
at com.spotify.android.appremote.api.LocalConnector.access$000(LocalConnector.java:36)
at com.spotify.android.appremote.api.LocalConnector$1.onConnectionFailed(LocalConnector.java:108)
at com.spotify.android.appremote.internal.SdkRemoteClientConnector$ConnectionTask.onPostExecute(SdkRemoteClientConnector.java:135)
at com.spotify.android.appremote.internal.SdkRemoteClientConnector$ConnectionTask.onPostExecute(SdkRemoteClientConnector.java:74)
at android.os.AsyncTask.finish(AsyncTask.java:695)
at android.os.AsyncTask.-wrap1(Unknown Source:0)
at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:712)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6938)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)
Thanks for your interest in the Spotify App Remote SDK!
If you're submitting a bug, please use the following template.
If your issue is a feature request, please include your use-case so that we have all the necessary info.
Issue found on DATE.
"app-remote-control", "playlist-read-private", "playlist-modify-private", "playlist-modify-public", "user-read-private", "streaming", "user-top-read", "user-modify-playback-state", "user-read-currently-playing", "user-read-playback-state"
In Debug mode, i can find this stacktrace in my log:
2018-11-13 00:01:05.058 922-922/? E/Spotify: [main] Failed to load image with uri: "". java.lang.IllegalArgumentException: Expected URL scheme 'http' or 'https' but no colon was found at zda.a(SourceFile:1325) at zcz.f(SourceFile:916) at zdm.a(SourceFile:165) at gcl.a(SourceFile:121) at xgy.a(SourceFile:44) at xlp.a(SourceFile:206) at xlp.run(SourceFile:159) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:457) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636) at java.lang.Thread.run(Thread.java:764) at xng.run(SourceFile:411)
This error often happens when i've just opened my app and push my playback-button. If i try it again, it usually works. So this is not that bad at all, but i also want to help you guys from spotify. I would love to use the android sdk in a no-betaVersion-way
Greetings ancash
P.S. Iam using a callback which detects when the Connect-Method finishes... If the callback is triggered, the playback starts. (Press Button -> Connect to SDK -> Callback -> Play Track) Maybe this is the painpoint. This is all information i can give you to help
SpotifyAppRemote.CONNECTOR.connect()
and play playlist URI with SpotifyAppRemote.play()
while screen is off and lockedSpotify should always start normally, with MediaSession and notification, even when screen is off.
Sometimes, Spotify will start in sort of detached-from-Android mode, where audio is playing, but Android System (and other apps) have no idea that it is actually playing. Symptoms of this mode include:
MediaSession
for SpotifyFixing this is pretty simple - I just have to turn on the screen, unlock the device and open Spotify app manually. After that Spotify's notification pops up immediately and normal operation resumes.
However, my main use case for this SDK is starting playback while phone is locked in my pocket. And having to sometimes take phone out to manually to fix it does cause some annoying usability problems.
com.example.touchfree_spotify E/MyActivity: {"message":"Client authentication failed: AUTHENTICATION_SERVICE_UNKNOWN_ERROR"}
My request _url is the same in my code and in the web. But it always show this error.
the request url is : http://example.com/callback/
The title says it all. :)
Execute this code:
val connectionParams = ConnectionParams.Builder(BuildConfig.SPOTIFY_CLIENT_ID)
.setRedirectUri(SpotifyConstants.REDIRECT_URI)
.showAuthView(true)
.build()
SpotifyAppRemote.CONNECTOR.connect(context, connectionParams, object : Connector.ConnectionListener {
override fun onFailure(error: Throwable) {
println("Failure")
error.printStackTrace()
}
override fun onConnected(remote: SpotifyAppRemote) {
println("Connected")
}
})
When doing this, there is a chance that Spotify app will be in stuck state, where connection to it will always time out, even through multiple connection attempts.
Spotify connection should succeed and onConnected should be called.
<App Name> is connecting
notification from Spotify app may or may not appear (I have experienced both, but other symptoms are the same)21:03:51.726 D/RemoteServiceIo: start remote client
21:03:51.742 D/RemoteServiceIo: Connecting to Spotify service
21:03:51.761 D/RemoteServiceIo: Spotify service connected
21:04:52.331 D/RemoteServiceIo: Message from Spotify: [3,{"message":"Internal error: TimeoutException"},"com.spotify.error.client_authentication_failed"]
21:04:52.342 D/RemoteServiceIo: stop remote client
21:04:52.354 I/System.out: Failure
21:04:52.357 W/System.err: com.spotify.android.appremote.api.error.AuthenticationFailedException: {"message":"Internal error: TimeoutException"}
21:04:52.367 W/System.err: at com.spotify.android.appremote.api.LocalConnector.asAppRemoteException(LocalConnector.java:121)
21:04:52.370 W/System.err: at com.spotify.android.appremote.api.LocalConnector.access$000(LocalConnector.java:36)
at com.spotify.android.appremote.api.LocalConnector$1.onConnectionFailed(LocalConnector.java:108)
at com.spotify.android.appremote.internal.SdkRemoteClientConnector$ConnectionTask.onPostExecute(SdkRemoteClientConnector.java:137)
21:04:52.371 W/System.err: at com.spotify.android.appremote.internal.SdkRemoteClientConnector$ConnectionTask.onPostExecute(SdkRemoteClientConnector.java:75)
at android.os.AsyncTask.finish(AsyncTask.java:695)
at android.os.AsyncTask.-wrap1(Unknown Source:0)
21:04:52.372 W/System.err: at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:712)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6499)
21:04:52.373 W/System.err: at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:440)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Caused by: com.spotify.protocol.client.error.RemoteClientException: {"message":"Internal error: TimeoutException"}
21:04:52.375 W/System.err: at com.spotify.protocol.client.RemoteWampClient.getRemoteClientException(RemoteWampClient.java:107)
at com.spotify.protocol.client.RemoteWampClient.access$200(RemoteWampClient.java:14)
21:04:52.376 W/System.err: at com.spotify.protocol.client.RemoteWampClient$1.onAbort(RemoteWampClient.java:36)
at com.spotify.protocol.client.WampRouterImpl.routeAbort(WampRouterImpl.java:110)
at com.spotify.protocol.client.WampRouterImpl.route(WampRouterImpl.java:32)
at com.spotify.protocol.client.AppProtocolCommunicator.onData(AppProtocolCommunicator.java:76)
at com.spotify.android.appremote.internal.RemoteServiceIo.handleMessage(RemoteServiceIo.java:118)
at com.spotify.android.appremote.internal.RemoteServiceIo.access$000(RemoteServiceIo.java:47)
at com.spotify.android.appremote.internal.RemoteServiceIo$IncomingHandler.handleMessage(RemoteServiceIo.java:96)
21:04:52.377 W/System.err: ... 6 more
Only fix I found for that is to force stop Spotify app. After doing so, next connection attempt succeeds immediately. My current workaround for this issue is to force-stop Spotify app before every connection attempt (very ugly workaround, I want to get rid of it ASAP, but it does the job).
I have no idea how exactly Spotify gets into that state. I experienced it after just playing the music and after it was idle for hours so I'm not sure if any battery saving stuff can cause this. Also, at the time of connecting, my phone definitely HAS internet connection (I browsed the internet on my phone while waiting for my control app to unsuccessfully connect and start music).
Thanks for your interest in the Spotify App Remote SDK!
If you're submitting a bug, please use the following template.
If your issue is a feature request, please include your use-case so that we have all the necessary info.
Issue found on September 27, 2018
Android Auto app remains the current media streaming app, with Spotify music playing through a backgrounded process.
Spotify app becomes the current Android Auto streaming app, music plays through Spotify.
I've tried to get image of the current song playing but the documentation is a bit hard to understand.
I get track image uri via "track.ImageUri" but how do I apply that image to my ImageView?
It would be great to temporarily change a spotify user's crossfade settings from this api.
Issue found on 17/10/2018.
0.5.0
android 7
connect
opens Spotify app if installed to authorize
i got this message
Can't connect to Spotify service with package com.spotify.music
Issue found on 09/12/2018.
0.4.0
Android 6.0 and Android 8.1.0
The Spotifiy Remote SDK plays the song only on the Android device running the method mSpotifyAppRemote.getPlayerApi().play(uri).
The potifiy Remote SDK plays the song on every device in the world connected with the Spotify Remote SDK using the same authentification info.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.