I am creating a macro (see my previous question:
https://stackoverflow.com/questions/35121221/difficulties-writing-a-custom-macro-application-for-android),
and that macro needs to recognize text from a certain area of the device screen while running in the background.
Basic summary:
The program will run in the background similar to a macro, while scanning for text in a messaging app (which I will manually open after starting the program)
Basically what it needs to do is read all text on screen and convert it into a string(I've got the rest of the code)
Now, I need some sort of help on the text recognition. Since I cant directly copy the text, I'd need some function to scan for text and convert it into a string.
Any help/pointers would be much appreciated.
Related
Apologies if there is already information about this. I couldn't find anything.
On Android, you can long-press an image and choose copy. On other apps, such as Messages, Discord, FB Messenger, and Twitter, the image will show up as a suggestion above the keyboard. If you tap it, it will upload the image to the text/tweet/etc. It also works when searching on Chrome - you can either select "Image you copied" or use the keyboard suggestion like with other apps. However, long-pressing the text input and selecting Paste does NOT work in any of these apps.
How does this image copy-paste function work? Is it something that could be emulated with other file types other than images, such as audio files? Can you force a file from an app to show up in the keyboard suggestions on other apps? Or, is it just a built-in feature that can't really be expanded on at all? Thanks for your help.
How does this image copy-paste function work?
Android has a Clipboard Framework which can be used to copy & paste content from one place to other
Is it something that could be emulated with other file types other than images, such as audio files
Android supports generic way to copy paste content, as long as the content is a standard multi-media type you can do copy paste. only prerequisite is that the both application should support the file-type.
The app you are copying the content should know how to put the data in the clipboard, and the app that you are pasting should know how to decode the content.
Android provide all information like, whats the content type and everything so what matters is both app should make use of this Clipboard framework.
Can you force a file from an app to show up in the keyboard suggestions on other apps?
You can't force it appear on top of keyboard, even a simple copied text will show only one time on top of keyboard. even though the content present on clipboard keyboard won't show it second or third time.
It's basically specific to how a keyboard app is designed, the above scenario is true for G-board at the time of writing this.
Overview
AFAIK on Android you have twi ways to set the texts of your application:
You can use string.xml with different locales
You can download strings from server and set every label with a setText(language.text) but it will be a pain
The problem might sussist if you have to change a text of your published application without re-publishing it; for example if you want to change for a specific translation a small text without any functionality change. (ie: you might notice that you wrote "Take picure" instead of "Take picture").
Library
i18next is a good library to manage translations dinamically from server, but you still have to add the text for each label you got.
So, my question is
Still AFAIK, there is no way to do it natively, but is there a low level library or a workaround that allows to replace a string in your string.xml with some downloaded text?
Another option could be to make our label text to point instead of at #string/myValue to something like #myresource.pathtovalue.
Honestly I think this could be an huge improvement for application, is there something useful?
I am working on an Android app which supports few other locales apart from English (like PTBr). I get the text from server in PTBr (Brazilian Portuguese) and I display it as it is in a Text view. I have also set my phone's locale to PTBr but still don't see the complete text. A few characters are missing.
I am stressing on "server-data" since I don't have it locally, and thus I can't put it in res-string folders.
Thanks!
I am building an app which requires the user to copy and paste a ten digit identification number from another app on the phone. Only thing is, in the other app, the ID number is presented as a header/title bar. I am sure it is not an image with text. Most apps for custom text capture require the user to take a screenshot and use some OCR operation to harvest the text from an image.
I find this as taking too many steps for my users, some of whom may not even know how to take a screenshot with android using the volume and power buttons.
Is there any way to copy and paste text that is un-highlightable on an app without using a screenshot?
Can I code my app to add context menu option on long press any text on screen so I can grab this text?
I try to download and run the offline voice recognization demo from this link - http://cmusphinx.sourceforge.net/2011/05/building-pocketsphinx-on-android/ . I m successfully install and run this demo project on device, but when i push and hold the button and when i release the button, it try to convert into text. The textfield "Your text goes here" becomes empty but it is not displaying the any result, i.e. Text of What we speak.
Please any one who run this demo successfully, help me with better suggestion.
Thanks in advance.
In my experience, the text field stays blank when there is some error in the configuration for the native pocket sphinx code. Any errors encountered by PocketSphinx should be printed to the log file. Figure out where your PocketSphinx log file is; it is set using the setLogfile(String path) function. One of the things that happens to me quite often is a mismatch between the words in the dictionary and the words in the language model/grammar. Since you probably haven't edited those, I'd say it could be a wrong path to one of them. The log file will tell you about anything that couldn't be loaded.