Intercept start and close app

Good morning everyone.
Please, I would need to count how many times my app was launched and how many times it was closed after the remote user installed it.
It's possible? There is nothing on the net.

That is possible, you would need the App to record every time it was launched - that would be accurate. How many times it was closed would obviously be the same total, but you can't really confirm that because the App can be closed via Android as well as from within the App (if you have provided a function to do that).

That data would then need to be sent to you - the App could do that too, an upload to your website, email or something like that - but you would need to have the agreement of your User to allow you to gather the information.

Thanks, Chris Ward, I don't think there will be any problems with the authorization but when I open the app I will ask for it.
The app I have in mind does not require sensitive data, not only, but also the launch and closing of the app, it does not indicate in any way, either the app or the area from which the data was sent, or others data, so no one will ever know who or which app sent the data.

I think the biggest problems he can solve can be:

  1. that, if the apps were several hundred, how not to overlap the data that arrives without losing some
  2. how to decrease the data accordingly when the app is closed
  3. it will be possible to start a timer continuously that can read the data from the Clodb.
    In short, how to make sure that the data does not collide with each other and the timer is activated only if the data exists and not always leave it active.
    Because being hundredths of a second it will certainly be a problem.

Furthermore, everything should happen in real time and from within the control app.
Certainly with some latency, or in any case if not a real time at least that the data in succession queuing are not lost and do not limit the reception of the same to the detriment of some.
I am studying there but I see it very hard.

Web Servers work asynchronously, so there is no clash (of course, if we are talking about several thousand Users, things might slow down, but your data is a simple integer, it couldn't be a smaller amount of bytes. Look at what the MIT Server does - supports approx 400,000 Users per month for several hours as they define their projects.

Why? Why not allow the App to count the number of times it is launched and when that count gets to a specific number, only then report?

Excellent solution.
So how do I proceed? Can anyone show me how to do it all?
In my mind I would proceed like this:

  1. every time the app opens in Screen resize, I register the opening that saves it in a label which in turn will be saved on the CLoudb
  2. Same thing for the closure, which will be carried out by the system as soon as you click on close, delaying the closure of two seconds so that it can save the data in another label and on the cloudb.

In the other app that will have to record the data I continue as follows:
I collect the data from the LCoudb and insert them in a label, when the label reaches number 20, I will save the opening data.
Same thing with the label that will have to intercept the closing data from the cloudb and will subtract them by stealing the exact data at that moment.
How about? Am I wrong something?

When the App is launched, recover the current record of total launches from TinyDb, +1, save the record. If the record has reached a pre-determined total (or launches have spanned a pre-determined period of time (day, week or month), send that data.

As I explained before, you cannot record the number of times an App is closed.

Ok again thanks for your patience, I hope that sooner or later someone will be able to find a solution.

Otherwise if I only have the opening data, these will be of little use, because they will not be real if I do not have the closing data as well.

Now I try what I had in mind by adapting it to what you suggested and see what comes out.
Have a nice day or evening, it depends on where you are.

Number of Closes = Number of Openings - 1

A user may open you app and never close it, just keep it in the background....

2 Likes

Of course you're right, but I don't care if you keep it open, I just need to know if it's open at that moment.
But if I can't intercept when it closes it will be a problem but I think I'm successful I'll let you know.
If you manage in the meantime, help would be really important.
Especially if the data doesn't collide and then the reading may not be real and that would really be another problem, but as "Chris" put it, this shouldn't happen.

Sorry for one last piece of information, I haven't received any general notifications for a long time.
I only get the answers to my questions.
Yet I have selected the authorization to receive them.
Yet it seemed to me that other times I also received alerts when someone entered new topics, or am I wrong?

Hello everyone, Chris and Timal2, or anyone else, please, can you help me create blocks, which can infinitely increment a label with content (o), remotely?
This would take me some steps forward in solving the problem.

What have you tried so far? Show your relevant blocks...

Seeing that they are not needed I deleted them, sorry but I did not understand it seemed easier to send you the.

This was my request....

But sorry Tmal2 not cpaisco, I sent you the complete .aia files there are all the blocks.
Explain better what you need, otherwise I don't understand.
More than giving you the complete project with all the blocks? ???
If you want I'll explain how they work, by installing the .aia file you will understand it.

I do not have the time or energy to work through your aia project to find the relevant blocks. Please show your relevant blocks.

I send you the images