jroal / a2dpvolume

Automatically exported from code.google.com/p/a2dpvolume
http://jimroal.com/slist.htm
95 stars 33 forks source link

Intent feature issues #276

Closed jroal closed 5 years ago

jroal commented 5 years ago

Hello Jim,

First of all, thanks for your work. The app is really nice!

Quick question regarding your app: I'm trying to not just start spotify when a device connects by bluetooth but spotify should also start playing!

There is an intent to do that:

Action: com.spotify.mobile.android.ui.widget.PLAY Package: com.spotify.music

But I can't figure out how to put that intent into your app. There are just 3 lines in the "custom intent" menu and I wrote the intent on the first line. If I test it, nothing happens and I can't click "ok".

I tried reading your github help but I can't get it working.

Could you give me a hint where and how to put that intent?

Cheers

Daniel

P.S. Screenshot attached

jroal commented 5 years ago

I have this wiki here: https://github.com/jroal/a2dpvolume/wiki/Custom-Intents. I need to look into this more. I have not tested this in many years. I was not sure anyone even used it. The code for this feature is here: https://github.com/jroal/a2dpvolume/blob/master/app/src/main/java/a2dp/Vol/CustomIntentMaker.java

schossel commented 5 years ago

Would be nice if you get it running. Sadly, I can't help with any of the code, I could only test it.

jroal commented 5 years ago

I started looking into it. Here is the function that runs the intent: https://github.com/jroal/a2dpvolume/blob/master/app/src/main/java/a2dp/Vol/service.java#L1319. You set either the package to start OR the action, data, and type. If a package name is there, it ignores the rest. Read this to better understand what belongs in action data, and type fields of an intent: https://developer.android.com/guide/components/intents-filters#java

I had a bug in the descriptions of the 3 lines so the names did not show. I fixed that for future releases. For now the 3 lines are (in order) action, data, and type. However, I found many other issues that will prevent this from functioning. I am working on it now...

jroal commented 5 years ago

OK, 2.12.11.2 makes fixes to the custom intent makes but I still can't get it to work with Spotify. I searched Stack Overflow and have not yet found a solution either. I think I may stop here. Can anyone else help figure this out?

cprhokie commented 5 years ago

I will take a look.

jroal commented 5 years ago

I found this: https://community.spotify.com/t5/Newcomers-and-Contribution/How-to-use-Tasker-or-NFC-Task-Launcher-to-launch-Spotify-to-play/td-p/366224

schossel commented 5 years ago

I found this https://stackoverflow.com/questions/43129548/pressing-play-on-spotify-through-an-intent

jroal commented 5 years ago

I fixed many issues with the custom intent builder and feature so at least the feature works now. I am working on pushing to Beta but having Play Store issues. You can sideload and test this: https://1drv.ms/u/s!AgUbpiol3wYLvHKOLSDntW-F94pO.

cprhokie commented 5 years ago

The only way I found to start music playing is to use action android.intent.action.VIEW and data/uri spotify:user:{userid}:playlist:{playlistId}:play where you have to substitute your own username/userid and playlist id. You can get your username from the spority web site account info. You can get the playlist id by right clicking on a playlist and copying the url. The problem with this is it will not start playing with the screen off. I tried many other combinations of intents and URIs that I found on stack overflow and the spotify forums. There is a spotify api that developers can use to play music but I think that is out of scope for this application.

jroal commented 5 years ago

A better approach may be to use something like Tasker to receive the intent from A2DP Volume or directly from the device connection. Details here: https://github.com/jroal/a2dpvolume/wiki/Interfaces. In fact, test some methods in Tasker. If you get one working let me know and I can see if the same thing can be done in A2DP Volume.

One thing missing from A2DP Volume is putting extras in the intent. The extras are often where details like playlists live. I thought about adding them but it would be a pretty big thing to do. A2DP Volume is becoming more obsolete all the time so I am not sure how much more to invest in it.

cprhokie commented 5 years ago

I wouldn't mind adding extra or some generic stuff if that helps - but don't think it really makes sense for us to spend a lot of time investigating all of the various music apps. If Spotify wanted to allow this they could easily publish a way to do this using an intent. Recommend closing this issue.

jroal commented 5 years ago

I am closing this as the basic intent features are fixed. The other request here was specifically for Spotify integration. Right now I think this is out of scope but I may revisit that later.