Pregunta

I have used the Psyonspotify code as the framework for integrating libspotify into my application. I stripped out a lot of the code as my application only needs to query tracks and create playlists, but the initialisation and run loop code I have kept.

I am using libspotify 12.1.51. I am testing on a HTC One running Android 4.2.2.

The library is performing well and I can login, query playlists, query tracks, create playlist and add tracks to playlists exactly how I want to. The problem is that somewhat randomly the application bails out with a SIGSEGV. I cannot pin down exactly where it happens, but it is definitely happening (occasionally) on calls to sp_session_process_events. As advised in a separate post I have guarded certain calls with a check on the connection state (sp_session_connectionstate).

In trying to find a solution I have come across issue-78 for cocoalibspotify on GitHub, the last comment (as of today) on which reads:

I'm getting a very similar crash in a vanilla libspotify-12.1.51 Mac app. Crashing in sp_error_message after session_process_events when the wifi drops.

I know that I have a really flakey wi-fi connection in my office and also a very weak 3G signal, could anyone from Spotify comment on whether this could be the cause of my difficulties? And if it is, is there any way that I can guard against it, or do I just need to wait for a new release of the library?

¿Fue útil?

Solución

Switching between 3G/WiFi has been a known source of libspotify problems in the past. It's possible that there is a crash with libspotify itself, I've sent a mail to the internal group which maintains libspotify to ping them for more information (I work at Spotify myself, but not in the libspotify team).

If the crash is coming from libspotify, there's not much you can do to guard against it, the best way is to abstract libspotify in an Android service (which I presume you are already doing) and then restart the service from the UI APK if you notice that it crashes. This might cost you a few seconds of waiting but it's better than the entire app going down in flames.

Edit: There's a new Spotify SDK for Android, which replaces libspotify and is much easier to develop with. You should migrate any libspotify projects to the new SDK.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top