How do I access all intent extras of a specific broadcast

Post your questions and help other users.

Moderator: Martin

Post Reply
6234234234
Posts: 6
Joined: 24 Dec 2015 15:33

How do I access all intent extras of a specific broadcast

Post by 6234234234 » 01 Nov 2016 12:02

Hi everyone,

I'm pretty sure this is really trivial, but I can't seem to figure it out.

I'm trying to get the albumid for the currently playing spotify album. For that I set up a General Broadcast trigger for the action com.spotify.music.metadatachanged.

I know from a tasker profile that the albumid is available from the broadcast, I'm simply trying something like this for the intent extras field:

albumid=getString("albumid")

But I don't know the name of the value for albumid, so I want to get everything that is in the broadcast.

I'm attaching the working tasker profile as well, maybe that is helpful.

Hopefully someone can point my in the right direction on how to do that.
Attachments
Spotify_Song_Changed.prf.xml
Tasker profile
(3.21 KiB) Downloaded 833 times

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: How do I access all intent extras of a specific broadcas

Post by Martin » 01 Nov 2016 14:07

Hi,

The names of the extras are case sensitive. You should get the value with getString("albumId").

Here's the list of extras that seem to be available:

Code: Select all

timeSent = getLong("timeSent", -1);
duration = getLong("duration", -1);
artist = getString("artist");
length = getInt("length", -1);
albumId = getString("albumId");
playbackPosition = getInt("playbackPosition", -1);
id = getString("id");
album = getString("album");
track = getString("track");
position = getLong("position", -1);
Some of the values are documented on this page:
https://developer.spotify.com/technolog ... fications/

Ensure that Device Broadcast Status in the settings of Spotify is enabled, otherwise Spotify does not send the broadcast.

I add the Spotify intents to the list of examples in Automagic since this might be of interest to others as well.

Regards,
Martin

6234234234
Posts: 6
Joined: 24 Dec 2015 15:33

Re: How do I access all intent extras of a specific broadcas

Post by 6234234234 » 01 Nov 2016 15:19

Oh man, so close, yet so far away :P

Thanks very much, this was exactly what I needed!

I'm not sure if you're aware of that, but automagic is playing a major role for some people in an open source home automation system called fhem.

You can read about it here.

http://www.fhemwiki.de/wiki/AMAD

I'm using this to get the album art and display it on my wall mounted tablet amongst other things.

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: How do I access all intent extras of a specific broadcas

Post by Martin » 01 Nov 2016 20:59

Thanks for the link. I was aware that Automagic is used with FHEM. Unfortunately I did not yet find the time to install FHEM myself.

Post Reply