Android Question Capture values from othe application

DanteS

Member
Licensed User
Longtime User
I need to write an Android application, to read values from the screen of another application running on the same mobile device and then perform some process with the captured values. Where should I start?
 

DanteS

Member
Licensed User
Longtime User
Thanks Andrew.
I downloaded an app in my cellular to monitor the price of a list of stocks when I am without internet access, to take actions manually if needed. But, for long periods without Internet I am going to need and app to capture the prices in my cellular, from the app downloaded and send these to my PC, where I have a windows application developped by me to manage a list of stocks
 
Upvote 0

Andrew (Digitwell)

Well-Known Member
Licensed User
Longtime User
Definitely sounds as if you are making things complicated.
Just have an app on your PC which gets the stock prices itself without going through the mobile app and performs whatever actions.
The mobile app can, when it has internet communicate with this app.

or maybe I'm misunderstanding something.
 
Upvote 0

MicroDrie

Well-Known Member
Licensed User
Longtime User
I think that a better start is to find the answers for the purpose and the means question.

I need to write an Android application, to read values from the screen of another application running on the same mobile device and then perform some process with the captured values.
This question is not a purpose, the way you formulate this question is the description of a remedy (a means) that excludes other creative solutions

Thanks Andrew.
I downloaded an app in my cellular to monitor the price of a list of stocks when I am without internet access, to take actions manually if needed. But, for long periods without Internet I am going to need and app to capture the prices in my cellular, from the app downloaded and send these to my PC, where I have a windows application developped by me to manage a list of stocks
So what you actually want to achieve (the purpose) is that you want to have an off-line price list which can be used on your cellular without an Internet connection (off-line)

To find a better answer on the purpose and means question we can reformulate your question into the following open question:
How can I create an off-line price list?
Then the following possible means can be found:
  1. Parsing HTML Code: by the use of jtidy with xml2map library, or jsoup
  2. For simple HTML web pages you can also try Regular Expressions (RegEx)
  3. With additional functionality for interacting with web pages: the WebViewExtras and WebViewExtras2 Libraries to manipulate and extract data from HTML elements.
Then the next question (not yet asked) is how to make the result list searchable. Without the URL :( of the on-line price list you could use a B4Xtable or if there is more complexity, the XLUtils / jPOI 5 - Read and write MS Excel workbooks is maybe a good oppertunity.

Given Google's current strict policy to "bar access to Android", a small screen size does not really make it easy to keep an overview when manipulating the data and this comment:
from the app downloaded and send these to my PC, where I have a windows application developped by me to manage a list of stocks
I recommend that you follow Erel's advice to develop the program under B4J as a B4XPages solution that has the ability to transfer the most recent list to the cellular.

I hope to have given you enough tools to find the best possible solution for your off-line price list.
 
Upvote 0

DanteS

Member
Licensed User
Longtime User
I am going to comment each comment of both Digiwell and MicroDrie

Just have an app on your PC which gets the stock prices itself without going through the mobile app and performs whatever actions.
Yes, the windows app get the prices from a web page by itself

The mobile app can, when it has internet communicate with this app.
No, the mobile app get the prices from I don´t know where and shows the list at the screen
So what you actually want to achieve (the purpose) is that you want to have an off-line price list which can be used on your cellular without an Internet connection (off-line)
No, I want to have a list or a file that I can use to update the stocks database in my PC.
  1. Parsing HTML Code: by the use of jtidy with xml2map library, or jsoup
  2. For simple HTML web pages you can also try Regular Expressions (RegEx)
  3. With additional functionality for interacting with web pages: the WebViewExtras and WebViewExtras2 Libraries to manipulate and extract data from HTML elements.

This sound OK. I do equivalent operations in the windows app to get the prices. I am going to investigate how to do something like this in B4A
Then the next question (not yet asked) is how to make the result list searchable
No, I don´t think that I am going to need a searchable list at this fase.

I recommend that you follow Erel's advice to develop the program under B4J as a B4XPages solution that has the ability to transfer the most recent list to the cellular.

This sound good to. Do yo have an example that I can use to study

Thankyou so much to both
 
Upvote 0

MicroDrie

Well-Known Member
Licensed User
Longtime User
Looking at the current restrictions of Android, it seems easy to choose either a web server or an FTP server solution.
 
Upvote 0

DanteS

Member
Licensed User
Longtime User
Thanks MicroDrie for your interest. I really appreciate this.
I have been to much inefficient explaining my case, so I am going to present it from a different perspective.

The process that I use in windows (coded in vb.net) and that I would like to emulate in B4A has three parts:
1. I execute a call to the Yahoo Finance web page using a WebRequest object wr=WebRequest.Create("https://finance.yahoo.com/quote/" & tkt), where tkt is the code of the stock ticket, like TSLA for Tesla o V for Visa.
2. I extract the text of the WebRequest with the method
wresp = wr.GetResponse()
3. Once I have the text, I seach it looking for some fixed words inside the text and obtaine the price and other data of the stock, using String functions.

a. Can I do something similar using B4A?
Or
b. If I have an app running in my cell named Yahoo Finance that shows the price of a stocks list at the screen, can I develop an app that extracts the prices from that app?
 
Upvote 0

MicroDrie

Well-Known Member
Licensed User
Longtime User
a. Can I do something similar using B4A?
Yes, given the list-like Yahoo web page, I recommend that you extract the desired information from the list with jsoup.

b. If I have an app running in my cell named Yahoo Finance that shows the price of a stocks list at the screen, can I develop an app that extracts the prices from that app?
Google is pursuing an increasingly restrictive policy on sharing information from or to an app (without the user's consent). I think it is therefore easier to build something with jsoup than to tinker with an existing app within the current Google rules.
 
Upvote 0

aeric

Expert
Licensed User
Longtime User
If I understand correctly, you want to do "web scraping" from a public website, in this case the Yahoo Finance website.
Check MiniHtmlParser.

Take note the page may change it's layout anytime and your app may need to be updated from time to time.
I suggest you to find any public API that can provide you with the information and call the API using OkHttpUtils2.

Then you want to build an Android app that can use in offline mode. You may need a local sqlite database inside the app where you can read the last downloaded or modified information.
You need to use SQL or CloudKVS.
 
Upvote 0

JohnJ

Member
Licensed User
Longtime User
Thanks MicroDrie for your interest. I really appreciate this.
I have been to much inefficient explaining my case, so I am going to present it from a different perspective.

The process that I use in windows (coded in vb.net) and that I would like to emulate in B4A has three parts:
1. I execute a call to the Yahoo Finance web page using a WebRequest object wr=WebRequest.Create("https://finance.yahoo.com/quote/" & tkt), where tkt is the code of the stock ticket, like TSLA for Tesla o V for Visa.
2. I extract the text of the WebRequest with the method
wresp = wr.GetResponse()
3. Once I have the text, I seach it looking for some fixed words inside the text and obtaine the price and other data of the stock, using String functions.

a. Can I do something similar using B4A?
Or
b. If I have an app running in my cell named Yahoo Finance that shows the price of a stocks list at the screen, can I develop an app that extracts the prices from that app?
My understanding is that your pc goes without internet access for some period of time. In that period you would use a B4A app to access the Yahoo stock feed and capture that data. There is a sample B4A program by Erel that does a currency conversion by grabbing data from the web. Search for "currency converter" in the forum. You can modify that code to go to Yahoo finance. There is also a sample B4J code that actually goes out to the Yahoo finance site to grab stock quotes. Search "stock" in the forum. The example is by user rwblinn. In the B4A app write your stock quotes to a text file, you can access that from your pc via a usb connection. I have an app on my phone that does that, it saves a copy of my table so that I can access it from my pc, thus giving me a backup.
Hope this helps!
 
Upvote 0

DanteS

Member
Licensed User
Longtime User
Thank You to all of you guys. Now I have muy backpack full of tools and ideas to go ahead.
I will report my progress periodically
 
Upvote 0
Top