Issue with android 9 call Java method

Post your questions and help other users.

Moderator: Martin

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

Issue with android 9 call Java method

Post by ziotempa » 21 Apr 2019 17:30

Hello
I have a Flow which gets an image from the share action, so that when I share an image from any app, Automagic intercepts it
I took this script in this forum but now I can't remember where... I can't remember who shared this
Anyway it's a script with a lot of Java in it.
Yesterday, after I updated my phone to Android, this script doesn't work anymore, it gives error here

ctx=getContext();
cr=callJavaMethod(ctx, "android.content.Context", "getContentResolver()");
input=callJavaMethod(cr, "android.content.ContentResolver", "openInputStream(android.net.Uri)", content_uri);

This line "input =..." goes to error. I don't absolutely know if and what I can do... Any idea?
Thank you
Vincenzo

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

Re: Issue with android 9 call Java method

Post by Desmanto » 21 Apr 2019 17:40

I believe you take it from here : viewtopic.php?f=5&t=7916&p=23877&hilit=anuraag#p23869

I am on Pie 9.0 too, and the flow is working fine. Maybe you change something in the script. I don't dare to change anything, as I have hard time with java. You should try to redownload the flow and try it again.

@Martin : Can we have the Send/Share Intent updated to automatically parse the file path from the latest android content uri share? Whatsapp, MiXplorer and many other app have started to use content provider and doesn't provide full path to the file. Or maybe is it possible that Automagic copy/link the file provided by other app to temporary path so we can use that? Most of my previous flows now broken because of this and I haven't fix them yet (use anuraag method).
Last edited by Desmanto on 21 Apr 2019 17:44, edited 1 time in total.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), Resurrection Remix Official 7.0.2 20190829, Pie 9.0, Rooted.

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

Re: Issue with android 9 call Java method

Post by ziotempa » 21 Apr 2019 17:43

:D great! Yes, that was it
Anyway I'm quite sure I didn't change anything because I don't know Java... Anyway I'll check it

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

Re: Issue with android 9 call Java method

Post by ziotempa » 21 Apr 2019 17:51

Ok, checked. It's the same. No difference :|

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

Re: Issue with android 9 call Java method

Post by ziotempa » 21 Apr 2019 18:05

I just discovered that the behavior has changed for the sharing of whatsapp... If I try to share from quickpic for example it works, the sharing from whatsapp gives the error

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

Re: Issue with android 9 call Java method

Post by Desmanto » 21 Apr 2019 18:15

Confirmed. Share from MiXplorer, the file path is correct. Share from Whatsapp, immediately error. I am totally clueless about this, need to wait for Anuraag.

BTW, for whatsapp, I create a specific flow for my usage. My friends usually send me a bunch of images/documents and ask me to print (computer network and phone can't be joined, corporate policy). So I just use init file to get the last images/documents saved in whatsapp folder. Parse them and auto select the last files in the last 30 minutes. Copy the list of file to a text file, use adb in PC (Executed by EventGhost) to cat this file and then pull the file to the RAMDisk. Hence I never bother to use send/share intent anymore.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), Resurrection Remix Official 7.0.2 20190829, Pie 9.0, Rooted.

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

Re: Issue with android 9 call Java method

Post by ziotempa » 21 Apr 2019 18:23

My program is a bit different, when I receive some image I can share to automagic, this starts a Flow where I can give it tags and the image is moved in a specific folder... Anyway it seems that the share intent works only in some specific programs, not all of the programs which can share work correctly

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

Re: Issue with android 9 call Java method

Post by anuraag » 22 Apr 2019 00:29

Permission Denial: opening provider com.whatsapp.MediaProvider from ProcessRecord{6327ac3 3034:ch.gridvision.ppam.androidautomagic/u0a144} (pid=3034, uid=10144) that is not exported from UID 10167
Last time when i tested it was working with WhatsApp. Maybe new WhatsApp builds did this. This flow doesn't work if "Parse content_uri" isn't placed just after trigger or "pick file activity" action . If there is multiple flows whuch contains "Send/Share Intent Received" trigger then also it will fail

I think stream_uri is getting lost between trigger and action.

Code: Select all

input=callJavaMethod(cr, "android.content.ContentResolver", "openInputStream(android.net.Uri)", content_uri);
This needs to be called immediately after content is shared to automatic. Which isn't possible from my side.
Last edited by anuraag on 22 Apr 2019 04:09, edited 6 times in total.

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

Re: Issue with android 9 call Java method

Post by anuraag » 22 Apr 2019 01:20

This is totally a mystery for me. It wasn't working before but now working on my android 8.1.
Tried 1.35, 1.37, 1.38 every build thows exception. But again works.
Screenshot_20190422-061937_1.png
Screenshot_20190422-061937_1.png (57.15 KiB) Viewed 1862 times
@ziotempa can you try my previous shared flow and disable your other flows which contains "Send/Share Intent Received"? Also try this by removing Automagic from android recents screen.

Edit: can you try this? It will give you temp file_path for now. If it works then i will make this complete.
Make sure there is no other "Send/Share Intent Received" trigger active.
flow_Get_temp_file_path_20190422_105811.xml
(4.67 KiB) Downloaded 71 times

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

Re: Issue with android 9 call Java method

Post by ziotempa » 22 Apr 2019 07:34

Sorry but I have this error with this new flow

exception_message
Method call failed (Expression: callJavaMethod(cr, "android.content.ContentResolver", "openInputStream(android.net.Uri)", callJavaStaticMethod("android.net.Uri", "parse(java.lang.String)", stream_uri))[line 2])

Post Reply