Send/Share intent HELP!

Post your questions and help other users.

Moderator: Martin

Post Reply
Friend1
Posts: 52
Joined: 03 May 2017 06:00

Send/Share intent HELP!

Post by Friend1 » 17 Aug 2017 08:01

Hi All,

Can any one help me for flow send/share using bluetooth or wifi by a basic example? Thanks!

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: Send/Share intent HELP!

Post by Desmanto » 17 Aug 2017 10:28

What kind of usage do you want? Because it is a very broad topic. Automagic can send intent via Action Start Activity, Start Service and Send Broadcast. But I almost always use only Start Activity.

For the starting, I recommend you to install Intent Interception. This app will reset all of you default app/share, so you need to set the default again for the first time. As it can intercept most intent share from other app. Thus you can use it to mimic the shared intent.

To Send file via bluetooth, you can try to share a file directly from you favourite file manager. For example, I share flow.xml from /sdcard/download/flow.xml. Choose Intent intercept, and you can see the result just like below. (other matching activities has been removed)
intent:#Intent;action=android.intent.action.SEND;type=text/xml;launchFlags=0x1b080000;end
------------
ACTION: android.intent.action.SEND
MIME: text/xml
URI: intent:#Intent;action=android.intent.action.SEND;type=text/xml;launchFlags=0x1b080000;end
FLAGS:
FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET
FLAG_ACTIVITY_FORWARD_RESULT
FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT
FLAG_ACTIVITY_PREVIOUS_IS_TOP
FLAG_RECEIVER_FOREGROUND
EXTRAS:
1 Class: android.net.Uri$HierarchicalUri
Key: android.intent.extra.STREAM
Value: file:///sdcard/Download/flow.xml


------------
MATCHING ACTIVITIES:
Bluetooth (com.android.bluetooth - com.android.bluetooth.opp.BluetoothOppLauncherActivity)
Send/Share Intent Received (ch.gridvision.ppam.androidautomagic - ch.gridvision.ppam.androidautomagic.SendIntentReceiverActivity)
The key point you want to check is
ACTION = Action in Automagic, so you wanna copy this.
MIME = Data MIME Type, you may need to copy this, to be spesific for certain file
EXTRAS = Extras, you need to make some modification to suit the intent.

For Above, it is android.net.Uri$HierarchicalUri, I would use function putUri(key, value). I still don't know every possible mapping between class and which function to choose, mostly I google it out.
As you can see, the Key is android.intent.extra.STREAM, and the value is file:///sdcard/Download/flow.xml
So the Extras in automagic will be

Code: Select all

putUri("android.intent.extra.STREAM", "file:///sdcard/Download/flow.xml ")
For other values like Flag list, just leave it default. Unless it is specified as well in the result of intercept. The file stream uri should be in encodedURL form. If you have space, the space should be %20. You can check if you share file name with spaces or symbol. File stream uri can be replaced with variable as needed.

Next, you wanna send it via bluetooth, so we need to find the bluetooth sender activity. At my phone, it is com.android.bluetooth, with the class com.android.bluetooth.opp.BluetoothOppLauncherActivity (just use automagic package name and class name to pick it up). You can try to execute it, it should be the same as trying to share the file directly and tap bluetooth in the share choice.


For Wifi, it is more complicated and the method will differ depends on your need. There is no direct way to send file via wifi, must pass thru app (except if both phone support the same protocol, such as wifishare in samsung phones). If both phones have automagic installed, you can use HTTP request to send the file. While the other way is to trigger the built-in wifi share (or other app such Es File Explorer), to send the selected file, by passing the uri stream to their activity.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

Friend1
Posts: 52
Joined: 03 May 2017 06:00

Re: Send/Share intent HELP!

Post by Friend1 » 17 Aug 2017 13:14

Hi Desmanto,

I would like to try the suggestions.I will use my own streams to send to another phone (with Automagic installed).Thank you very much for your quick reply.
Respects. :D

skiptannen
Posts: 82
Joined: 13 Jan 2014 21:39

Re: Send/Share intent HELP!

Post by skiptannen » 22 Aug 2017 19:07

Desmanto,

I was interested in the functionality of the Intent Interception app you mentioned but the link you provided is broken. I did a quick search for "intent" in the Play Store, but there are a large number of results and I don't like downloading apps that are completely unknown to me. Could the app you referenced be named something else or do you have a link that works?

Thank you.

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: Send/Share intent HELP!

Post by Desmanto » 23 Aug 2017 05:10

That link is to the playstore, just tested, it is still working. Probably the app is not available at your country. Strange, I search from office PC, the link also show not available. You can check at github https://github.com/intrications/intent-intercept

There is alternative link in F-droid site, but still v2.2.4 (playstore version is v2.2.5). The package name is uk.co.ashtonbrsc.android.intentintercept, with the dev name Intrications
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

skiptannen
Posts: 82
Joined: 13 Jan 2014 21:39

Re: Send/Share intent HELP!

Post by skiptannen » 23 Aug 2017 09:38

Okay, thanks for checking.
Desmanto wrote:That link is to the playstore, just tested, it is still working. Probably the app is not available at your country. Strange, I search from office PC, the link also show not available. You can check at github https://github.com/intrications/intent-intercept

There is alternative link in F-droid site, but still v2.2.4 (playstore version is v2.2.5). The package name is uk.co.ashtonbrsc.android.intentintercept, with the dev name Intrications

Post Reply