Hi Taifun,
Thank you for your kind reply.
I submitted exactly the same question yesterday in my topic here: https://community.appinventor.mit.edu/t/catch-text-data-sent-by-android-share-menu/14459) and it looks funny that Steve_Silberberg did the same question just some hours later!
That's a pity such feature is available in Kodular, but not in App Inventor. I am really involved in this matter and now I am even more eager as I know somebody else is looking for the same feature.
So, I am just attempting to implement this feature by an extension, but unfortunately my Java skills are quite poor and I am experiencing several issues. Here below there is the Java code extension I somehow wrote, but I can't compile it:
I am pretty sure the error is related to Intent and getIntent() method usage: as far as I know, they should come from Activity class or something like that, but I don't know how to solve and move on. I noticed you used getIntent() method in your Clipboard extension, but I can't figure how you did.
Any help would be very appreciated.
Thank you again.
Hi @Salvatore_Oliva
I checked the file and found that you have only implemented blocks to get shared file/text.
To be able to show your app in Share to list you will have to add specific mime types in manifest with the help of @UsesActivities.
Here is an example of it:
Hi Sunny, thank you for your kind feedback.
Actually, I already solved the issue about editing Manifest file in order to add the proper Intent filter for mime text type (I unpacked and packed again APK app by APK Editor Studio): I can find my app listed in Share menu, but I can't figure out a way to pull and retrieve the shared text block in my app (I already tried by get plain start text block included in Screen1.Initialize event, but it does not work)...
So I eventually decided to attempt a different path, by building up a specific AI2 extension, with the purpose to receive and handle the sharing Intent: now my problem is different and it is about my Java code of the extension, that does not compile:
As far as I can understand (unfortunately my Java skill are quite limited), getIntent() method belongs to Activity class, that should somehow be extended by my component class, but at this point I am stuck.
Any helpful suggestion? @Taifun: which is your opinion? I have seen indeed you used that method in your Clipboard extension.
Thanks all again. Until next time.
no need to create your own extension...
just follow the advice by @vknow360 and use the DeepLink extension template... just add your desired scheme and host and build your individual extension
see also
Hi Sunny,
I examined attentively DeepLink repository and I found your project very interesting and useful. Actually, it seems exactly what I am looking for, with a little difference: I would like to highlight a block of text within any Android app, then long tap, select Share item in pop-up menu and send that block to my app, that should eventually get it. As far as I see, your extension looks rather capable to process and filter an hyperlink the user taps on, in order to decide if it has to be opened by an AI2 app.
Anyway, I think your approach is good and I feel I am on the right way, so I tried to somehow modify your Java file as per your suggestions, in order to fit it to my need, but, after several attempts fiddling with @UsesActivities section, I could not make it work. Here below there is Java file I edited:
Where am I wrong? May be necessary modify as well OnCreate() method code accordingly? If so, how?
Thank you so much again for your kind and patient support.
Hi Sunny,
Outstanding work!!!
I can't really find any proper word to express my wonder and my gratitude!
After having a look into your Java code, I feel astonished and I honestly acknowledge I would not have solved by myself as newbie. Besides, you did even more than I needed for: your extension is actually capable to share any kind of data: text, pictures, media. My sincere congratulations for your advanced problem solving skills and your deep Java knowledge.
Thank you so much a lot, you are great!
Since this turns out to be a valuable work, let me just suggest you to submit this project to a Github repository, even better you could merge it with your DeepLink project.
My sincere respect and many thanks again!
Salvatore
i am really new to this MIT App Inventor and i came across this page while i am looking for a process to make my application visible in share menu (when user clicks on share along with available applications my app also needs to be available) i don't really understand how this can be achieved or what needs to be done.
Hey! I've tested your extension and it works somehow, the problem is that if i share a .txt file the value is the filename and not the text inside the file... is there a way to get the contents of the file?
The problem is that the file module has problems loading the file with spaces in the name... but if i replace " " with "%20" it says that the file could not be found...