It's about StopTask?
No, show me all of your blocks related to background service and reading.
It's ok now after I'm using KIO4_Terminal.aix. I will prepare my solution. Please, give me information about stopping the process
Normally, the StopProcess block will stop the service and destroys the registered events, and components, does this not work for you?
It stops after some minutes, as I've described.
Do you mean it takes few minutes for it to stop?
I'll wait for you to post your blocks, so that I can take a look into it.
Can you please use the StopTask block instead in the place you are calling StopProcess?
StopProcess can only be used within the background service.
Hm. The process started after an app goes into background. After the activity of the app changed to the "stop". Or, maybe I don't understand properly how an app goes into background? The goal of my app - working during approximately 40 minutes - 1 hour, and phone might be used in another apps. Should I start task or process in this case?
Start process is the best thing in your case, a foreground service is more reliable than normal services that could be limited by various reasons.
Interesting... Seems, Itoo extension does not work with boolean compairing blocks like this:
In my app task doesn't start with these blocks. Compairing of numbers and text works well.
Hi!
I was releasing an app that is a wifi ring bell, and I am finding the next problem:
I need to check Firebase constantly to know when someone has pressed the ring button, this is why I need the app to continue working in background and foreground.
In order to achieve this I have been reading about many background services and I decided to try ItoO. I need to keep checking the database to identify when the call flag is up, for this reason, I am using the DataChanged event from the Firebase extension, but I need to be able to include it in a function from ItoO. This is not possible as the when block does not allow this. That is why I was going to ask if someone has figured a workaround for this issue.
So far the app works while open, but once I close it (after several minutes) it stops working.
Thanks in advance!
Try to register an event with eventName "FirebaseDB.DataChanged", procedure name left without changes, but in the procedure "Check" define inputs "tag" and "value". And do the same as in the native FirebaseDB event. But, as I understand, it will fire only once. And don't forget to put the block "evaluate but ignore result" with Firebase component before registering event
Right, but it is recommended to use the Firebase Database REST API alternatively to the firebase component for background services.
You can achieve the same functionality through the API.
Thanks for the help, certainly the code seems better now, I receive a message that the app is in background -which is good-, but I struggle to receive the data from the database while in background.
Following the lead from Kumaraswamy, I am doing it with the REST API, but I go back to the same problem, I can not check the value from my database with the library.
Thanks in advance!
You should add an argument called "x" to the procedure "Check".
Then you should register an event called "Clock2.Timer", providing a procedure callback, from where you will do the get request.
Like this:
@Kumaraswamy, the problem with StopProcess still exists... Even if I stop the process from inside.
Please, look. Here my blocks from my working example:
I'm compairing value of the variable from TinyDB. When process starts, it become equal to "0".
But, when app starting again and Screen1.Initialize, it changed to 1. After that Notification of Taifun's location service disappeared, icon of the Foreground service disappeared too, but Notification from the background task continue appear every 1 second. And it shows that process does not running!
It continue to appear from 1 to 10 minutes, or sometimes even more, I restarted my phone and do not know, how long it would appear. Is it possible to fix it?
UPD. Ok, this one works:
It stops the task completely after 2nd iteration.
But, as for me, it's complicated a little and implicit. To stop the process and task immediately as for me, this one the only solution - to do such "if" condition.
Hi, I believe this is something to do with the comparing results.
As per your edit, i understand that it's working fine after adding "if" condition, let me know if something is not right yet.
Hi, I have been testing the comments you did yesterday, but with no luck.
I am just trying to make a sound whenever the callstate variable is equal to 1. But it is not being triggered.
I will describe what I expect to happen because perhaps I misunderstand the background service and perhaps I need the foreground one:
-Once the user closes the app (with the home button only), the database has to be continuously checked to search for a change in a certain variable (callstate).
-If callstate is equal to 1, it has to trigger a sound (simulating that you are receiving a call).
-If the callstate is equal to 0, it has to stop the sound (just in case it was being played before).
Later, once this works, I will try to use one more timer to make it sound continuously.
Thanks in advance!
PD: perhaps the error is in the web URL that I introduced? I want to access OnGoingCall variable:
And in the database it looks like:
It should be giving the result of ongoingcall, right?
Hi, yes you should start a foreground service instead in your case, replace the url with another simple example url, then after the got text procedure is triggered, for verification, send a notification to alert (for testing purpose), after you are sure the web functionality is working, replace the urls with the real ones.