Hello Taifun, thank you again for your feedback.
To be honest, my first trials were on my old phone, that runs an older Android version. So, according to your suggestions, I tried again my app on my new phone, that is Android 15 based and that will be the actual device where my app is supposed to eventually run. My app behaviour is the same of the videoclip I posted yesterday, and I have no problem in reading the file, even by background service, since it is created in a directory inside the external storage (file:///storage/emulated/0/my-working-time/provisional-today-times.txt).
Let's instead focus on the actual problem: from my previous picture, I picked up only the most remarkable blocks, that I suspect are concerned in the malfunction:
I already use StopProcess (see picture above) and I don't want modify and overcomplicate an app that is supposed to make a simple operation (by the way, you were previously suggesting me that Broadcast feature was not necessary for my case).
So, my only and actual question is: why I can successfully stop the service in BackgroundMainTimer Event (see red comment "Background service stopped here OK"), but I can't when I push the buttons (see red comments "Background service stopped here does not work")? The operations performed are exactly the same: so, why the effect is not the same?
The only different condition I see is the value of AppGoingToClose? flag (it is set at the end of BackgroundPrvFileTimesGotText Event, it is visible in the bottom of my above picture), that decides if the moment has come to stop the service: when I press the buttons, that flag is still False, but under the logical point of view this should not affect the app behaviour...
I post here aix file of my project: WorkTimeNotifyService.aia (304.2 KB)
Hello Taifun,
I followed your last suggestion, but I see a severe problem concerning the handling of Clock component in background and I can't understand the reason.
I simplified as more as possible my app, by stripping away all the unneeded features, and I included a notifier to show an alert message in the spots when the secondary Clock (BackgroundStopTimer) triggers and when StopProcess procedure is executed.
Then, as you advised, I set to stop straightly the service inside the buttons events, without passing by the secondary Timer.
Apparently, MainClock.TimerEnabled and StopClock.TimerEnabled instructions are effective only inside BackgroundMainTimer event; whenever invoked by buttons or elsewhere, they are totally ignored, so main timer Clock keeps running.
Here the blocks of my debug trial:
And here a videoclip showing the malfunction:
Here below the AIX project file of this debug version:
In the debug version I included the button Set All Times to set the flag AppGoingToClose?, that decides when background service and timers have to stop.
The expected behaviour is that one related to Set All Times button: the timers are properly handled and eventually the clocks and background process are correctly stopped.
On the other hand, when I use the buttons (Stop Work Notify Service in the app interface or Stop Service in the notification), background process and timers do not stop, even though they are expressedly disabled/stopped by StopService procedure. In both case, StopService procedure is invoked (see the alert messages), so why in the latter case process and timers do not shut off?
Do not use the Notifier.ShowAlert method in the background... in the background there is no user interface... for debugging use the Notifier.LogInfo method instead and check logcat
Hello Taifun, thank you again for your prompt feedback.
I would to simplify the things even more and I decided to resume my basic example app, that I used as template for the development of my actual app. Here below its blocks and AIA file project:
At that time, I tested such app on my old phone, that runs an older Android version (10 or 11) and it was working like a charm. Today, I tested it also on my new phone (Android 15 based) and I see the same exact problem: the disabling operation of the Clock (Clock1.TimerEnabled = False) and/or Itoo.StopProcess operation is ineffective, so the timer keeps triggering in background.
Therefore, it is quite strange that there is a case where my actual app stops background service and timers successfully, since it is supposed to not.
At this point, I am going to suspect that Itoo extension has some inconvenience with the latest Android versions, so it would be nice to get the opinion of Kumaraswamy as well.
Hello Taifun,
As per your suggestion, both on my old phone and new phone, I generated logcat log file of only Error level messages (adb logcat *:E) with Simple Itoo Project app running:
While logcatting, the app has been launched, then I started background process, then I closed the app, finally I tried to stop the process by the button on the notification message. On the old phone, process/timer has stopped successfully. On the new phone, as I already told you, process/timer does not stop and the timer keep triggering, so I tried up to 5 times to stop it, but in vain.
I had a look at the logs and I see errors occurring both on old and new phone, but honestly I have no clue how to read and decode these logs.
As usual, any help from your side will be very appreciated.
Could you please help me, I can't get the web component to work, only the sound works with the notification, I already checked and did the same as the documentation you did but it doesn't work for me.
This is what I need please, I'm going to send you a donation for your great work, but I can't get it to work please
What do you want to do after the Web Request? Play a sound and show a notification? Then you have to register event for Web1.GotText with 4 parameters.
Create a procedure called Web1.GotText with 4 parameters that of the event.
In fact, I performed the same procedure that you mention but it still does not work, my intention is to activate a sound when executing the web component when I get a response, but it does not work.