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.