Issues with "Intent Received" event and uppercase key extra variable access Broadcast receiver woes

1,762 views
Skip to first unread message

Luna Deveillion

unread,
Aug 27, 2013, 10:32:56 AM8/27/13
to tas...@googlegroups.com
Hellp Pent and Tasker community!

According to the docs I can access extra data attached to the intent via its name:
1#Intent: org.package.name.some_variable ==> Tasker var: %some_variable -- This is *working*
2#Intnet: org.package.name.OTHER_VARIABLE ==> Tasker var: %OTHER_VARIABLE -- *no access*

Since most of the broadcast intents (System and apps) I want to use have uppercase keys I have the problem that I can't get the extra data.
I guess that this is an issue with the resulting "Global Variable" due to the uppercase key character.

So far I found only in the "Broadcast receiver woes" topic from 5th Aug 2013 a solution to have an option for sending lowercase intent keys in the sending plugin.

Is this uppercase intent capture a bug in Tasker or is there another solution? Help is appreciated :-) 
Cheerio Luna


Tasker: v4.2b3 (external access/system admin active) || Android 4.3 / CM10.2

Pent

unread,
Sep 3, 2013, 10:09:01 AM9/3/13
to tas...@googlegroups.com


According to the docs I can access extra data attached to the intent via its name:
1#Intent: org.package.name.some_variable ==> Tasker var: %some_variable -- This is *working*
2#Intnet: org.package.name.OTHER_VARIABLE ==> Tasker var: %OTHER_VARIABLE -- *no access*

No, that's not hat the doc says:

"For example, a boolean extra with key sound_on, will be available via the local variable %sound_on.  "

In your first example, the key should be org.package.name.some_variable, similarly for second.

Pent

Pent

unread,
Sep 3, 2013, 10:09:58 AM9/3/13
to tas...@googlegroups.com
But yes, you're probably correct about the upper case. Will check the code and make everything lower case
if necessary.

Pent

Luna Deveillion

unread,
Sep 4, 2013, 6:50:16 AM9/4/13
to tas...@googlegroups.com
Hi Pent,
thanks for looking into it.
I'm looking forward to see your evaluation or the update ;-)
Luna.

Pent

unread,
Sep 4, 2013, 8:31:50 AM9/4/13
to tas...@googlegroups.com

I'm looking forward to see your evaluation or the update ;-)

I didn't see that upper-case could cause problems (it's more likely the missing package name in
your original post), but I decided to make everything lower-case to fit with all other local
variables being lower-case.

Pent

Luna Deveillion

unread,
Sep 4, 2013, 7:25:03 PM9/4/13
to tas...@googlegroups.com
Hmm, I hope I won't trash myself by revealing that I didn't understood the 
whole intent thing, but for fiddling with Tasker options for intents and to 
know the exact input I've set up following small testing arrangement:

=================================================
#1_TASK - sending an intent:
Action: org.some.package.INFO_STATUS_CHANGED
Cat: None
Mime Type: *empty*
Data: *empty*
Extra: ITEM_FLOWER:The only ONE!
Extra: have_flowers:Very Special Ones!!!
Package: *empty*
Class: *empty*
Target: Broadcast Receiver
=================================================

=================================================
#2_PROFILE - "Intent Received" event:
Action: org.some.package.INFO_STATUS_CHANGED
Cat: None
Cat: None
Scheme: *empty*
Mime Type: *empty*
Priority: Normal
Stop Event: *unselected*
=================================================
#2_LINKED_TASK: only a "flash action" with:
Text: 
Extra#1 data:
%org.some.package.INFO_STATUS_CHANGED.ITEM_FLOWER
%org.some.package.info_status_changed.item_flower
%org.some.package.INFO_STATUS_CHANGED
%org.some.package.info_status_changed
%org.some.package.ITEM_FLOWER
%org.some.package.item_flower
%INFO_STATUS_CHANGED
%info_status_changed
%ITEM_FLOWER
%item_flower
Extra#2 data:
%have_flowers
=================================================

Tasker is catching the intent correctly and reacts with the linked flashing task, 
but I receive only the data from the 2nd EXTRA (=>"Very Special Ones!!!") 
None of the variable combinations (hope I didn't miss one) is catching the data 
of the 1st EXTRA (=>"The only ONE!").

When I use "item_flower:The only ONE!" as input for the first EXTRA the 
variable "%item_flower" picks its content, since it's all lower case values aside 
the data.
Also by adding "Package: org.some.package" to the sending task, the profile isn't 
capturing the intent event at all.

Is there somewhere a massive fallacy or do I irritate Tasker by sending intents
for none existing packages?

I hope this may help finding a solution and thanks for helping so far ;-)

Pent

unread,
Sep 5, 2013, 2:12:28 AM9/5/13
to tas...@googlegroups.com
The package name is irrelevant, unless it's also in the
extra key.

Wait for next update for the upper case problem.

Pent

Jason Weyermars

unread,
Sep 5, 2013, 1:59:32 PM9/5/13
to tas...@googlegroups.com
I've been scratching my head with this for a while today - I look forward to this update as well.  I'm attempting to receive intent extra data from Yatse which includes a lot of uppercase.

Thanks!
Jason

Jason Weyermars

unread,
Sep 10, 2013, 1:45:55 PM9/10/13
to tas...@googlegroups.com
Hi Pent,

I noticed the latest update includes the fix for the intent extras, changing them to lower-case.
I'm attempting to verify this within my tasks, but can't seem to access the extras.

The extra being passed is an integer, with the name:  org.leetzone.android.yatsewidget.STATUS_FLAG
If my understanding is correct, then the variable should be: %org.leetzone.android.yatsewidget.status_flag

I have tried this, as well as %status_flag without success.  Is my understanding correct in this area?

Thanks and cheers,
Jason

Luna Deveillion

unread,
Sep 10, 2013, 4:29:20 PM9/10/13
to tas...@googlegroups.com
Thanks Pent, so far my issue is resolved with the Tasker v4.2b7 update. Great support!

@Jason: I'll maybe check your issue later on, but as I see from the link: I need an unlocker for YATSE?

Jason Weyermars

unread,
Sep 10, 2013, 10:00:20 PM9/10/13
to tas...@googlegroups.com
Hi Luna,

Yes, the one I'm using requires the unlocked Yatse widget (for the API usage..)  I have, however, done some further testing on my own tonight and think I've narrowed it down.

When the extra has dots in it, the local variable is not being populated.  To test this, I created an action that sends an intent to broadcast receiver, and then added a profile for intent receive:

Task:  Send intent, Action=com.dubbs, Extra=com.dubbs.ACTION:play, Target=Broadcast Receiver
Profile event receive intent: Action=com.dubbs --> run "Task Intent Receive"
Task "Intent Receive" : Flash %com.dubbs.action

What's displayed with this is simply: "%action"

When I change the extra to something without the dots, but with upper-case "Extra=comdubbsACTION:play" then it works as expected and populates the local variable %comdubbsaction=play  I suspect the dots are not being parsed correctly and preventing the population of the variable.  I tried another test with _ instead of . and it works successfully.  So it may be localized to dots.

I'd be happy to test with you to correct this, as I know the Yatse API that I'd like to hook into is heavy on mixed case and lots of dots.

thanks for looking at this!
Cheers
Jason

Jason Weyermars

unread,
Sep 10, 2013, 10:03:28 PM9/10/13
to tas...@googlegroups.com
one small correction:
What's displayed with this is simply: "%com.dubbs.action"

Pent

unread,
Sep 11, 2013, 2:35:57 AM9/11/13
to tas...@googlegroups.com
>When the extra has dots in it, the local variable is not being populated.  To test this, I created an action that sends an intent to broadcast receiver, and then added a profile for intent receive:

Thanks for the hint, I'll try that.

Pent

Pent

unread,
Sep 11, 2013, 11:27:34 AM9/11/13
to tas...@googlegroups.com
Yes, problem confirmed, the variable name and value are recorded, but later on other parts
of Tasker don't think it looks like a proper variable so leave it alone.

I think the best solution is to replace all non-legal variable name characters with _.

So extra this.is.an.EXTRA_OK would become %this_is_an_extra_ok

Yes, think I'll go with that.

Pent

Pent

unread,
Sep 11, 2013, 11:41:54 AM9/11/13
to tas...@googlegroups.com
Here are the rules for next update:

In addition, any extras attached to the intent can be accessed under their name, with the following modifications to make them valid variable names:

  • all letters will be converted to lower-case
  • non-letter-or-digit characters will be converted to _
  • names not starting with a letter will have a prefixed
  • names not ending with a letter or digit will have a affixed

For example, an extra with key %SOUND_ON will be available as %sound_on, and an extra with key package.SOUND_ON!, will be available via the local variable %package_sound_on_a


Pent

Pent

unread,
Sep 11, 2013, 11:44:16 AM9/11/13
to tas...@googlegroups.com
Sorry, typo, SOUND_ON -> %sound_on, %SOUND_ON would become %a_sound_on, if I didn't
make another error :-)

Pent

Jason Weyermars

unread,
Sep 11, 2013, 11:50:07 AM9/11/13
to tas...@googlegroups.com
Awesome - thanks very much for the quick attention on this.  This is really helping with some home automation projects come to life.

zachstr

unread,
Sep 19, 2013, 12:33:20 AM9/19/13
to tas...@googlegroups.com
Well, I have the same problem that you did. I can get tasker to recognize when the intent is broadcast, and I have it flash what should be the local variables, but none of them are ever set. I am using Yatse as well. I just wanted to know if you have been able to get the values from the extra local variables in the intent. I want to get the media title, specifically. Have you gotten it to work? You seem to be the only other person online with this sort of issue.
Thanks.

Pent

unread,
Sep 19, 2013, 2:10:36 AM9/19/13
to tas...@googlegroups.com
>Well, I have the same problem that you did. I can get tasker to recognize when the intent is broadcast, and I have it flash what should be the local variables, but none of them are ever set. I am >using Yatse as well. I just wanted to know if you have been able to get the values from the extra local variables in the intent. I want to get the media title, specifically. Have you gotten it to work? >You seem to be the only other person online with this sort of issue.

Try reading the last few messages on the thread.

Pent

zachstr

unread,
Sep 21, 2013, 1:49:14 AM9/21/13
to tas...@googlegroups.com
I have, but I cannot seem to get the data from the extra values in the local variables. I am using this site for reference http://yatse.leetzone.org/redmine/projects/androidwidget/wiki/Api#Broadcast-Intent-Unlocker-only-Yatse-360-
(the same as Jason above). I have a profile which flashes a notification when an intent is received from org.leetzone.android.yatsewidget.INFO_STATUS_CHANGED. I am trying to get data from the extra fields, which include org.leetzone.android.yatsewidget.MEDIA_FILENAME. Am I wrong in that I should be able to flash the variable %org_leetzone_android_yatsewidget_media_filename to get the data? I have tried variations of this, and all don't work. I receive the intent, but the toast only shows the variable name (with the % and all), and nothing else. Any help would be appreciated. I'll keep working at it, but so far I've had no luck.

Pent

unread,
Sep 21, 2013, 5:59:25 AM9/21/13
to tas...@googlegroups.com

I have,

I'll summarise then: 'wait for the next update then read the userguide doc on intents'.

Pent

Jason Weyermars

unread,
Nov 24, 2013, 2:45:40 PM11/24/13
to tas...@googlegroups.com
Thanks very much for the work on this.  The intent extras are being parsed correctly now and I'm successfully responding to broadcast intents from Yatse.
Cheers!

Pent

unread,
Nov 25, 2013, 2:26:21 AM11/25/13
to tas...@googlegroups.com

Thanks very much for the work on this.  The intent extras are being parsed correctly now and I'm successfully responding to broadcast intents from Yatse.


Phew, had me worried when I noticed a reply to this thread :-)

Pent

Mark Lavercombe

unread,
Jan 4, 2014, 10:48:00 PM1/4/14
to tas...@googlegroups.com
Hi Jason,
I'm struggling to figure out how to structure the profile and tasks to respond to the Yatse broadcast intents.
I hope you won't mind giving me (and anyone else) a tip?
Cheers!

Jason Weyermars

unread,
Jan 5, 2014, 1:41:05 PM1/5/14
to tas...@googlegroups.com
Hi Mark,

No problem.  Below are some text exports of a limited portion of my yatse intent stuff.
There is a profile called "Yatse Intent Received" which fires off the task "XBMC Intent Received" task.  In this case, I want tasker to understand a state change in XBMC, in particular, if I pause/resume media in XBMC outside of tasker (like by remote control, or another app, etc.)

In this case, there is an intent received, I parse for the intent extras that I'd like to address and action:

Profile: Yatse Intent Received (73)
Event: Intent Received [ Action:org.leetzone.android.yatsewidget.INFO_STATUS_CHANGED Cat:None Cat:None Scheme:* Mime Type:* ]
Enter: XBMC Intent Received (72)

Task: XBMC Intent Received (72)
A1: [X] Flash [ Text:Intent data: %intent_data
Action: %evtprm1
First cat: %evtprm2
Sec cat: %evtprm3
URI: %evtprm4
MIME: %evtprm5
Extras:
STATUS_FLAG:
%org_leetzone_android_yatsewidget_status_flag
Isplaying:
%org_leetzone_android_yatsewidget_media_isplaying
Host status: %org_leetzone_android_yatsewidget_host_status Long:On ] 
A2: Perform Task [ Name:XBMC Remote Resume Stop:Off Priority:5 Parameter 1 (%par1): Parameter 2 (%par2): Return Value Variable: ] If [ %org_leetzone_android_yatsewidget_media_isplaying ~ true ]
A3: Perform Task [ Name:XBMC Remote Pause Stop:Off Priority:5 Parameter 1 (%par1): Parameter 2 (%par2): Return Value Variable: ] If [ %org_leetzone_android_yatsewidget_media_isplaying ~ false ]


Here you can see, that A1 (currently disabled) will flash a toast message with various variables from the intent.  In particular, I want to know if the current intent is telling me if the media state changed to playing, or paused.  I then call my respective tasks "XMBC Remote Resume" if the intent says the media is playing, or "XBMC Remote Pause" if the intent says it was paused.

The reason I want to know the media state change, is that I sometimes have my philips Hue lights connected to the state of XBMC (variable %XBMC_LinkLights)  If they are connected, when XBMC pauses, I want the lights to brighten.  When it resumes, they go back into a dim mode. 

Task: XBMC Remote Pause (181)
A1: If [ %XBMC_LinkLights ~ true ]
A2: Perform Task [ Name:Hue ALL Relax Medium Stop:Off Priority:5 Parameter 1 (%par1): Parameter 2 (%par2): Return Value Variable: ] 
A3: Perform Task [ Name:COM Ack Stop:Off Priority:5 Parameter 1 (%par1): Parameter 2 (%par2): Return Value Variable: ] 
A4: End If 

Task: XBMC Remote Resume (195)
A1: If [ %XBMC_LinkLights ~ true ]
A2: Perform Task [ Name:Hue ALL Night Mode Stop:Off Priority:5 Parameter 1 (%par1): Parameter 2 (%par2): Return Value Variable: ] 
A3: Perform Task [ Name:COM Ack Stop:Off Priority:5 Parameter 1 (%par1): Parameter 2 (%par2): Return Value Variable: ] 
A4: End If 


Sending intents is much easier.  For example, I have profiles/tasks that will display SMS caller identity (you could flash the message content if you wish - but you never know who's watching with you ;)   I also have profiles/tasks that if a call comes in (or I initiate an outgoing call) to pause the media.  When the call is done - resume.  I know Yatse has built-in support for this, but I want the advanced integration with tasker so I can interface with the lights, etc.  So when everything is enabled, if a phone call comes in, these profiles/task combinations basically show the caller ID on the TV via a notification to yatse, then it pauses the media and brightens the lights.  When I hang up, the lights dim, and XBMC resumes automatically.

Profile: Anon (46)
State: Call [ Type:Incoming Number:* ]
Enter: Notify Phone Call Incoming (60)
Exit: Notify Phone Call Exit (107)

Profile: Anon (75)
State: Call [ Type:Outgoing Number:* ]
Enter: Notify Phone Call Outgoing (114)
Exit: Notify Phone Call Exit (107)

Profile: Anon (113)
Event: Received Text [ Type:Any Sender:* Content:* ]
Enter: Notify SMS (85)

Task: Notify SMS (85)
A1: Perform Task [ Name:XBMC Notification Stop:Off Priority:5 Parameter 1 (%par1):Incoming transmission... Parameter 2 (%par2):Communique from %SMSRN Return Value Variable: ] 

Task: XBMC Notification (30)
A1: Send Intent [ Action:org.leetzone.android.yatsewidget.ACTION_MEDIA_NOTIFICATION Cat:None Mime Type: Data: Extra:org.leetzone.android.yatsewidget.EXTRA_STRING_PARAMS:%par1|%par2 Extra: Package: Class: Target:Service ] 

Task: Notify Phone Call Incoming (60)
A1: Perform Task [ Name:XBMC Pause Stop:Off Priority:5 Parameter 1 (%par1): Parameter 2 (%par2): Return Value Variable: ] 
A2: Perform Task [ Name:XBMC Notification Stop:Off Priority:5 Parameter 1 (%par1):Incoming transmission... Parameter 2 (%par2):Call from %CNAME Return Value Variable: ] 

Task: Notify Phone Call Exit (107)
A1: Perform Task [ Name:XBMC Resume Stop:Off Priority:5 Parameter 1 (%par1): Parameter 2 (%par2): Return Value Variable: ] 

Task: Notify Phone Call Outgoing (114)
A1: Perform Task [ Name:XBMC Pause Stop:Off Priority:5 Parameter 1 (%par1): Parameter 2 (%par2): Return Value Variable: ] 


I have a lot more that I've done with Yatse (like updating library, etc.) but once you get the hang of the basic intents and parsing the extras - you can pretty much do whatever you like.

Feel free to contact me if you need to discuss further..
Good luck!

Jason

Patrick Simonds

unread,
Jan 5, 2014, 2:59:17 PM1/5/14
to tas...@googlegroups.com
Hey Jason, I too have been able to parse the extras out of the YATSE broadcast intents.
However, there are some values I cannot seem to populate no matter what.
According to the YATSE API doc, the values MEDIA_SHOW_EPISODE, MEDIA_SHOW_EPISODE, and MEDIA_SHOW_TITLE should populate when you watch a TV show.
I can't get mine to work. I'm able to dump most of the other documented data to local variables. I'm using an "If Set" conditional in my Set Variable tasks, which seems to work fine.

I haven't even really begun messing with doing stuff with the info once I have it dumped to local variables, because I got hung up on not grabbing the TV episode info. Any advice on this?

Mark Lavercombe

unread,
Jan 5, 2014, 11:13:58 PM1/5/14
to tas...@googlegroups.com
Hi Jason,
Thanks so much, I suspected it would be harder than that, but am grateful as I hadn't been able to work it out for myself! I now have my custom XBMC remote scene running through tasker and yatse with eventghost providing backup via autoremote for things like amplifier (which I prefer to use for volume).
Your help is very much appreciated.

@Patrick:
Are you getting those variables filled with the yatse intent names instead of them being blank when not set? I found that instead of using "Is set" it only worked with "doesn't match regex" ^%.*
In other words:

If %org_leetzone_android_yatsewidget_media_show_title !~R ^%.*

Don't know if this will help you, but "Is set" didn't work for me.
Cheers!
Message has been deleted

Mark Lavercombe

unread,
Dec 3, 2014, 4:03:41 PM12/3/14
to tas...@googlegroups.com
Hi Jason and Patrick.
Did the intent received process change? I haven't been receiving intents from Yatse for a while now, and cna't seem to figure out why...
Any suggestions would be wonderful!
Cheers!

Jason .

unread,
Dec 4, 2014, 8:34:46 PM12/4/14
to tas...@googlegroups.com
Hmm I think you're right.  I just tried, and I'm note receiving, but can still send intents.  I'll try to take a peek over the weekend.

--
You received this message because you are subscribed to a topic in the Google Groups "Tasker" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/tasker/qdhJhJ8ksHk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to tasker+un...@googlegroups.com.
Visit this group at http://groups.google.com/group/tasker.
For more options, visit https://groups.google.com/d/optout.

Jason .

unread,
Dec 4, 2014, 10:50:58 PM12/4/14
to tas...@googlegroups.com

​hmm scratch that - intents are working for me.  I turned off intent broadcast in yatse, then re-enabled it.  Not sure if that helped.

Mark Lavercombe

unread,
Dec 5, 2014, 4:50:47 AM12/5/14
to tas...@googlegroups.com
thanks.
I reinstalled yatse. broadcast intents only work when in foreground mode...
I turned on the notification in yatse settings and now I can access intents without yatse in foreground.
I might email tolriq as this might need a 'foreground' mode setting like in tasker to ensure the intents are always sent.
Thanks again!
Reply all
Reply to author
Forward
0 new messages