Image save

Post your questions and help other users.

Moderator: Martin

Post Reply
ziotempa
Posts: 55
Joined: 30 Nov 2018 08:54

Image save

Post by ziotempa » 27 Feb 2019 18:19

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)?

anuraag
Posts: 371
Joined: 24 Jan 2015 02:06

Re: Image save

Post by anuraag » 28 Feb 2019 03:14

There is a share option "Store as file".

ziotempa
Posts: 55
Joined: 30 Nov 2018 08:54

Re: Image save

Post by ziotempa » 28 Feb 2019 08:17

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

anuraag
Posts: 371
Joined: 24 Jan 2015 02:06

Re: Image save

Post by anuraag » 28 Feb 2019 08:29

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.

ziotempa
Posts: 55
Joined: 30 Nov 2018 08:54

Re: Image save

Post by ziotempa » 28 Feb 2019 08:54

Thanks, it seems exactly what I need. Is there any detailed guide to do it?

anuraag
Posts: 371
Joined: 24 Jan 2015 02:06

Re: Image save

Post by anuraag » 28 Feb 2019 09:05

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.
Attachments
flow_Get_file_name_file_type_file_path_20190228_143342.xml
(6.5 KiB) Downloaded 863 times
Last edited by anuraag on 12 Jul 2019 01:54, edited 2 times in total.

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

Re: Image save

Post by Desmanto » 28 Feb 2019 17:24

@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.
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.

ziotempa
Posts: 55
Joined: 30 Nov 2018 08:54

Re: Image save

Post by ziotempa » 28 Feb 2019 19:01

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?

anuraag
Posts: 371
Joined: 24 Jan 2015 02:06

Re: Image save

Post by anuraag » 01 Mar 2019 02:00

@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?

ziotempa
Posts: 55
Joined: 30 Nov 2018 08:54

Re: Image save

Post by ziotempa » 01 Mar 2019 07:03

Thank you, for now it's enough. It works flawlessly!

Post Reply