Looking at the manifest, I see that Automate is capable of listening to automate:// URLs.
In particular, com.llamalab.automate.LocalBroadcastActivity has this intent filter:
<intent-filter> <action android:name="android.intent.action.VIEW"/> <category android:name="android.intent.category.DEFAULT"/> <category android:name="android.intent.category.BROWSABLE"/> <data android:scheme="automate"/> </intent-filter>
My theory is that I can make a flow with a broadcast receiver
that waits for some specific URI of that format to be called to do
an action.
To try it, I call the following:
adb shell am start -a android.intent.action.VIEW -d automate://asdf?something=123456 -f 8
It sort of works, since I can see some output in logcat from the LocalBroadcastManager from androidx:
04-04 15:04:58.406 15255 7168 V IntentResolver: Scheme list: [ActivityIntentInfo{5ae9e2f com.llamalab.automate/.LocalBroadcastActivity}, null]
04-04 15:04:58.406 15255 7168 V IntentResolver: Matching against filter ActivityIntentInfo{5ae9e2f com.llamalab.automate/.LocalBroadcastActivity}
04-04 15:04:58.406 15255 7168 V IntentResolver: 141c0bc com.llamalab.automate/.LocalBroadcastActivity filter 5ae9e2f
04-04 15:04:58.406 15255 7168 V IntentResolver: ResolveInfo{ce30a46 com.llamalab.automate/.LocalBroadcastActivity m=0x208000}
04-04 15:04:58.408 15255 7168 I ActivityManager: START u0 {act=android.intent.action.VIEW dat=automate://asdf?something=123456 flg=0x10000008 cmp=com.llamalab.automate/.LocalBroadcastActivity} from uid 2000
04-04 15:04:58.408 15255 7168 V IntentResolver: Resolving type=null scheme=automate defaultOnly=false userId=0 of Intent { act=android.intent.action.VIEW dat=automate://asdf?something=123456 flg=0x10000008 cmp=com.llamalab.automate/.LocalBroadcastActivity }
04-04 15:04:58.421 16224 16224 V LocalBroadcastManager: Resolving type null scheme automate of intent Intent { act=android.intent.action.VIEW dat=automate://asdf?something=123456 flg=0x10800008 cmp=com.llamalab.automate/.LocalBroadcastActivity }
That last line is enabled by doing `adb shell setprop log.tag.LocalBroadcastManager VERBOSE` and having that flag value of 8 earlier.
However, my broadcast receiver does not proceed.
My question is: what is the way to use this functionality and
accomplish my use case?
I think redirects may be resolved by the intent system since (I
think) app deep link services determine whether to launch the
given app or send you to the Play store. I could be mistaken,
however, as I have not done much app development. Maybe you have
to use the intent: URI scheme? I
tried that briefly and didn't get anywhere, but perhaps I did it
wrong.
My usage of "am start" is actually correct since it targets an
activity. When the activity is chosen to be launched (by way of
another app launching a VIEW intent with the proper URI) then
according to my reading of the disassembly, the
LocalBroadcastManager from androidx is simply called to deliver
the intent as a broadcast instead.
--
You received this message because you are subscribed to a topic in the Google Groups "Automate" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/automate-user/ZjRUNgu1T3U/unsubscribe.
To unsubscribe from this group and all its topics, send an email to automate-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/automate-user/ff31d8c5-3b41-42fb-9838-e261c0a06719n%40googlegroups.com.
Please find attached an example. First install the flow, then open the HTML file.
I could not get the broadcast receiver for Automate to work. The ZXing one below does work, however.
Did I miss something when crafting the URL?
To view this discussion on the web visit https://groups.google.com/d/msgid/automate-user/d1e15974-1399-44ee-b0bb-0a6b5c2661e1n%40googlegroups.com.
That doesn't seem to work unfortunately.
Looking at the AndroidX source, here is where the broadcasts are actually dispatched. When I have more free time (😅) I will debug the app to try to see if this gets triggered.
To view this discussion on the web visit https://groups.google.com/d/msgid/automate-user/555c4870-3d2e-467d-92f9-01b1e16407e1n%40googlegroups.com.