Using the Intent Received event

2,189 views
Skip to first unread message

Tom McDonald

unread,
Jul 17, 2013, 3:00:20 PM7/17/13
to tas...@googlegroups.com
Disclaimer: I don't know much about Android dev, but I am a developer. I think I have a basic fundamental understanding of intents, but don't know all of the inner workings. I'm probably going to make up terminology a little bit here.

Does the Intent Received event get triggered when an intent is broadcast in general, or only when the intent is sent directly to Tasker? I'm trying to create a profile that will capture an intent (potentially sent by any application), manipulate it a bit, and resend it to whomever is listening. I have a particularly annoying app that rewrites its URLs to first hit its own site to count the click, then redirect to the actual URL. This causes the browser to open when it wouldn't need to in some cases, e.g. a YouTube link, since YouTube is listening for URL intents that match youtube.com.

Also, what are some ways I can test Intent Received? I've tried creating a profile that listens for Intent Received (no action specified), and then alerts %intent_data, but I can't seem to invoke it. I've tried clicking links within apps, sharing from one app to another, etc... nothing seems to trigger this profile. I've even tried adding an action to launch an app, just in case I was simply missing the message, but no avail.

Thanks,
Tom McDonald

Tom McDonald

unread,
Jul 17, 2013, 10:03:56 PM7/17/13
to tas...@googlegroups.com
I'm coming to realize that the part I'm most stuck on is what values to use for the Intent Received parameters (Action, Cat, etc.). Can I use a generic action like android.intent.action.VIEW or does it need to be specific to the app that would be sending the intent? Are there any examples of overriding an intent fired by an app? Is this even possible?

Pent

unread,
Jul 18, 2013, 3:56:46 AM7/18/13
to tas...@googlegroups.com

I'm probably going to make up terminology a little bit here.

Nice disclaimer :-)

Does the Intent Received event get triggered when an intent is broadcast in general, or only when the intent is sent directly to Tasker?

Depends what you specify for the parameters.

Have a look at the Intents section of the userguide (and the link to the Android docs).
 
I'm trying to create a profile that will capture an intent (potentially sent by any application), manipulate it a bit, and resend it to whomever is listening. I have a particularly annoying app that rewrites its URLs to first hit its own site to count the click, then redirect to the actual URL. This causes the browser to open when it wouldn't need to in some cases, e.g. a YouTube link, since YouTube is listening for URL intents that match youtube.com.

Also, what are some ways I can test Intent Received? I've tried creating a profile that listens for Intent Received (no action specified), and then alerts %intent_data

You probably need to specify something. It's a bit black magicy. Note that not all intents have data in them.

, but I can't seem to invoke it. I've tried clicking links within apps, sharing from one app to another, etc... nothing seems to trigger this profile. I've even tried adding an action to launch an app, just in case I was simply missing the message, but no avail.

Note that the event can only receive intents targetted at broadcast receivers (as described in the doc..)

Pent

Tom McDonald

unread,
Jul 18, 2013, 7:04:33 AM7/18/13
to tas...@googlegroups.com
Is there an easier way than decompiling the app to tell the type and data set in the intent? I'm starting to get the impression that it may be easier to just make an Android app in this particular case (which was my idea before I knew about Tasker).

Is it common for apps to use broadcast receiver? I read a bit about it in the Android docs and it seems like it's sort of discouraged, as other methods would be easier.

Pent

unread,
Jul 18, 2013, 7:29:07 AM7/18/13
to tas...@googlegroups.com



Is there an easier way than decompiling the app to tell the type and data set in the intent?

Ask the developer ?
 

Is it common for apps to use broadcast receiver?

Depends what they want to do.

Probably every app uses a broadcast receiver for something or other, because the framework uses
them extensively.

Pent

Tom McDonald

unread,
Jul 18, 2013, 11:09:17 AM7/18/13
to tas...@googlegroups.com
Okay, thanks. I'll try asking the developer and see what I can do.

Tom McDonald

unread,
Jul 18, 2013, 5:05:30 PM7/18/13
to tas...@googlegroups.com
So I've done a bit more research and I think what I'm looking to do won't be possible with Tasker. From the documentation below (Android Developer), I'm lead to believe that the Intent I'm trying to capture (clicking a link in the Facebook News Feed) is not done via a BroadcastReceiver, but rather is most like an Activity.
 
There is no way for a BroadcastReceiver to see or capture Intents used with startActivity(); likewise, when you broadcast an Intent, you will never find or start an Activity. These two operations are semantically very different: starting an Activity with an Intent is a foreground operation that modifies what the user is currently interacting with; broadcasting an Intent is a background operation that the user is not normally aware of.
Reply all
Reply to author
Forward
0 new messages