Page 1 of 1

Image save

Posted: 27 Feb 2019 18:19
by ziotempa
Hi there
Is there anyone who can explain how to build a Flow with which, whenever I share an image from any application, it would take that image and save it to a specific folder (I would declare the path in the Flow itself)?

Re: Image save

Posted: 28 Feb 2019 03:14
by anuraag
There is a share option "Store as file".

Re: Image save

Posted: 28 Feb 2019 08:17
by ziotempa
Hi, not all programs have this option and my request is just a part of a more complex Flow, so I want to do other things on the file. What I don't know is how to receive the image share action with automagic and how to save the image received

Re: Image save

Posted: 28 Feb 2019 08:29
by anuraag
When you share an image or file then there is 2 option by Automagic provided. One Send/Share Intent and Store as file.

If you use first one then you have to use send/Share Intent Received as trigger and then query Content Provider action or java script.

Re: Image save

Posted: 28 Feb 2019 08:54
by ziotempa
Thanks, it seems exactly what I need. Is there any detailed guide to do it?

Re: Image save

Posted: 28 Feb 2019 09:05
by anuraag
Edit: New flow http://automagic4android.com/forum/view ... 5c5#p24596

Here is one i have created for myself. Use debug dialog and check variables
file_name, file_type, file_path.

Later you can use copy file action.

Re: Image save

Posted: 28 Feb 2019 17:24
by Desmanto
@anuraag : Oh, I am completely stuck on those java. :shock:
Some app started to use content provider to share the file. Whatsapp, MiXplorer and many more. Afaik we can use the built-in action query content provider to do it, but I still can't get it right.

Re: Image save

Posted: 28 Feb 2019 19:01
by ziotempa
anuraag wrote:Here is one i have created for myself. Use debug dialog and check variables
file_name, file_type, file_path.

Later you can use copy file action.
GREAT! Thank you very much... I'm sorry because i thought it would be easier, I don't know if I'll be able to get the meaning of all that code. Anyway it does what I need.
Would you tell, without entering into much detail if you don't want, what does all that code do?

Re: Image save

Posted: 01 Mar 2019 02:00
by anuraag
@Desmanto you are correct. We can use built-in action query content provider to get infos. But we can't get file path from all apps like web browser. We can't get real file path. In my case i am not getting file path from whatsapp also.
And for MediaProvider(content://com.android.providers.media.documents/), DownloadsProvider(content://com.android.providers.downloads.documents/), ExternalStorageProvider (content://com.android.externalstorage.documents/) we have to use multiple query Content Provider action. When using multiple action there is always chance we lose the stream_uri connection.

So above flow uses multiple query Content Provider and gets real path of those and when its unable get path (browsers or other apps) then file will be copied to "Android/data/ch.gridvision.ppam.androidautomagic/cache/tmp" and give temp file path.

Above action can also be used after Automagic's action start activity (build-in example pick file) to get file path.

I have created it using help from stackoverflow codes.

@zeotempa let me know if above isn't enough?

Re: Image save

Posted: 01 Mar 2019 07:03
by ziotempa
Thank you, for now it's enough. It works flawlessly!