BimmerGestalt / AAIdrive

Implementations of some Android Auto features as unofficial IDrive apps
MIT License
540 stars 90 forks source link

Spotify doesn't show any content without internet connection #584

Open daniel1v opened 2 years ago

daniel1v commented 2 years ago

Even though, there is Spotify offline content on my phone, AAI shows an empty library.

This can be reproduced by turning on Airplane mode before opening AAI.

hufman commented 2 years ago

I can also replicate this, even if Spotify is specifically in Offline mode. I'm not sure what AAIdrive can do to fix this, however. Android Auto has special access to Spotify, while AAIdrive uses the Spotify App Control API which doesn't seem to provide the Offline Library option.

daniel1v commented 1 year ago

I think there is also an issue on AAI side. As soon as the internet connection is established, AAI gets content from the Spotify SDK, but it is not passed to the car. I have to switch active media source to another AAI based music app (vlc for example) and then back to Spotify, to get the content in IDrive. Also a Bluetooth reconnect works. I think the empty library is cached somewhere and is not refreshing automatically, as soon as internet connection is available.

hufman commented 1 year ago

I believe you may be encountering a limitation where the Spotify SDK can't authenticate if the phone is offline.

daniel1v commented 1 year ago

hi @hufman , thank you for your reply. I think I was not able to describe the issue clear enough.

The issue is the following: I start my car inside my garage, where I have no internet connection. My phone connects to car and AAI app connection is also established. When I select Spotify as the media source inside the car, the library is empty. When I open up AAI app, the library inside the app is also empty. The app shows, it is able to browse and search my library.

As you wrote above, this is a limitation of the Spotify SDK, so nothing could be changed at this point.

But there is another issue which prevents me from browsing the library, after the internet connection is available:

When I drive out of the garage, I am instantly able, to browse the Spotify library inside the AAI app. But I am still not able to browse it inside the car. Again: AAI is indeed able to browse the library, but does not pass it to the car. I found two workarounds: First one is to disconnect and reconnect my phone via bluetooth. And the second one is to select vlc media (or any other AAI based music app) as media source inside the car and then switch back to spotify as active media source.

So I am very sure, that the issue is, that AAI does not pass the refreshed library to the car, as soon as it has access to it.

The issue is reproducable by utilizing airplane mode:

  1. activate airplane mode
  2. enable bluetooth
  3. start car and wait for bluetooth and app connection to be established
  4. select spotify as media source
  5. see empty library
  6. disable airplane mode and wait for internet connection to be established
  7. open aaidrive app and double check, you can browse spotify library inside the app
  8. try to browse spotify library inside the car (it will be empty and stay empty, until you utilize one of my workarounds described above)

I hope I could clarify the issue better than before. I am aware, that there are limitations, coming from the Spotify SDK and also that the SDK has to do the authentication, to be able to browse the library. But the point is, that the AAIDrive app is indeed able to browse the library, but in the car, the library is empty.

hufman commented 1 year ago

Thank you for clarifying! How are you refreshing the AAIdrive app library? If you back out of the mini player to the music app list, and then click back into Spotify, this disconnects the Spotify SDK connection and reconnects. Effectively the same as switching the car to VLC and back to Spotify. There's logic to reconnect the app if it's entirely disconnected when you click back into it. However, since at least one method of control is connected, it doesn't trigger the reconnect logic. I could try figuring out a workaround for this.

daniel1v commented 1 year ago

Thank you for your answer.

I refresh AAI by pulling down and the content appears instantly inside the AAI app. So there should be no SDK reconnect involved. I think the issue is, that AAI does not forward the refreshed library to the car.