Issue with android 9 call Java method
Moderator: Martin
Issue with android 9 call Java method
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
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
Re: Issue with android 9 call Java method
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).
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), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.
Re: Issue with android 9 call Java method
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
Anyway I'm quite sure I didn't change anything because I don't know Java... Anyway I'll check it
Re: Issue with android 9 call Java method
Ok, checked. It's the same. No difference
Re: Issue with android 9 call Java method
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
Re: Issue with android 9 call Java method
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.
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), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.
Re: Issue with android 9 call Java method
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
Re: Issue with android 9 call Java method
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 failPermission 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
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);
Last edited by anuraag on 22 Apr 2019 04:09, edited 6 times in total.
Re: Issue with android 9 call Java method
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. @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.
Tried 1.35, 1.37, 1.38 every build thows exception. But again works. @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.
Re: Issue with android 9 call Java method
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])
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])