Yes, but does that imply that there is no way from onPause back to onResume (without triggering onStop)?
According to Google, it should be possible to:
Yes, but does that imply that there is no way from onPause back to onResume (without triggering onStop)?
According to Google, it should be possible to:
No, it does not imply that. All it implies is that you can't go to a stopped
state without first going through the paused
state. Going from onPause
to onResume
is a valid path and happens often. To see it, start the companion app (no need to connect) and do the following:
adb logcat | egrep -i "Form.*(pause|resume)"
And then turn the screen on and off a few times. You should see messages like this:
06-29 12:51:22.630 19439 19439 I Form : Form Screen1 got onResume
06-29 12:51:53.009 19439 19439 I Form : Form Screen1 got onPause
06-29 12:51:56.106 19439 19439 I Form : Form Screen1 got onResume
06-29 12:51:57.594 19439 19439 I Form : Form Screen1 got onPause
06-29 12:52:03.564 32353 32353 I Form : Form Screen1 got onResume
06-29 12:52:13.012 32353 32353 I Form : Form Screen1 got onPause
06-29 12:52:17.690 32353 32353 I Form : Form Screen1 got onResume
onPause is called whenever the app goes into the background, such as when the screen is locked. When the screen is unlocked, onResume is called because the app will come into the foreground.
I could not execute this (adb logcat) command. But even if this were the case, there must be an error in my or the Tools extension from Taifun or the AppOnPause /Stop /Resume events of Kodular, because onStop is also always triggered there.
(I'll send you the java code of the extension via PM.)
I tried this and get the following result
which means, @Anke is correct according to my tests?
@ewpatton you might want to test again using for example
adb logcat | egrep -i "Form.*(pause|resume|stop)"
@Anke, please don't forget to follow the naming conventions... UpperCamelCase for property, method and event names (i.e. the first letter should be a capital letter) and lowerCamelCase for parameter names
Taifun
Yes, that's true. On a phone it does appear to call onStop for an activity because the first activity is completely replaced by the new activity. If you use an app in Split Screen mode on a tablet or on a Chromebook, focusing on the second app will result in an onPause event but no onStop because the first app is still on the screen, just not active.
From what I found, these two callbacks never get invoked for extensions.
@pavi2410 Kindly elaborate it a little more.
sir dont have onDestroy????????????????????????
Don't spam with question marks please, they don't look nice.
sir we want to execute a command before user close the app not on app is not visible. so that the onDestroy will be our need. thanks
it badly need lang sir.. sorry...
Well I am sure about that.
You can't get it.
so you mean there's no solution sir.
I have a timer that always counts up, which should also count in the background. I added the extension for that. But the problem is that it doesn't always work, so sometimes it works great, sometimes it doesn't. If the screen is on but I'm not in the app, then it works too. It just doesn't work when the screen is closed.
Show your blocks.
And what do you mean by "background"? Is the app closed or just not visible but not closed?
First, thanks for the quick response.
I'm making a time tracking app that counts and saves the working hours - a so-called time clock. So the timer should always run when the screen is on but I'm out of the app when the screen is closed etc. So the timer should always run.
I would like to create an app like this:
The Blocks:
Back Pressed:
Back pressed is for not being able to push back.
EingestempeltTxt:
Stamped Text is a label that shows when one has Stamped.
EingestempeltBtn:
Stamped Button is a TimePicker where you can optionally enter when you stamped.
Clock2:
There are three texts in Clock2. One for seconds, one for minutes and one for hours. If seconds is greater than 59, than seconds is reset to 0 and text minutes is plus 1. If minutes is greater than 59, than minutes is reset to 0 and hours of text are plus 1. And with TinyDB, the working hours are saved so that you can later see how long you worked, etc.
Initialize:
When initializing, Clock2 is set to True so that it should count up as soon as it starts, like other time clocks.
The question is, is it even possible to create such an app here? If not, it is possible with other similar programs such as Kodular etc.
Since the app has to be open (active) at the time of clocking in and clocking out (taking timestamps), I don't see any problems implementing such apps with AI2 (or Kodular, Niotron, ...).
Try this simple app (initially just for one day and one break / pause):
Of course, it should be "Clock in"
I changed / updated it.