@Kumaraswamy , Hi, I am planning to create an app that gives continous alarm sound until the user stops it. This alarm sound will be heard as a Notification to the new email that says 'New order Recieved from a Customer'.
You cannot use UI Components in the background.
You only need preparatory for before Itoo.RegisterEvent. If you have used any other block from that component, preparatory call isnt required.
It's because the component is only created when it's touched or accessed.
Nice idea
Opps! bad example...
... but thanks for answering the question I was trying to ask
...and a question that I did not ask, but I was wondering about.
Looking forward to learning about and using itoo.
Kind regards,
Randal
Hello,
I am an App Inventor user, and I want to record incoming calls in my application. However, I need to ensure that this process continues even when the application is closed. Therefore, I am considering creating a background service.
My Challenges:
- I need to create a service that continues to run in the background even when the application is closed.
- This service should constantly monitor and record incoming calls.
Seeking a Solution:
I need assistance on how to approach this with App Inventor. So far, here are the steps I've taken:
- I added the Itoo extension to my project.
- I created a background process using the "CreateProcess" block and placed it inside the "Screen1.Initialize" block.
- I wrote the necessary code within the background process to monitor incoming calls.
However, it seems that the background process is not running when I close the application.
Points Where I Need Help:
- What is the correct approach to create a background service with App Inventor?
- How can I ensure that the background service continues to run even when the application is closed?
- How can I monitor incoming calls within the background service?
Additional Information:
You can also use the images I provided to overcome this issue.
Thank you.
you forgot to create the PhoneCall component in the background before registering the event
also your procedure is save_call_logs and not save_call_logs_to_local
and f you want to store something in the background, let me suggest you to use the FetchProperty/StoreProperty blocks rather than a global variable/TinyDB
Taifun
Hi @bay_max, thanks for the details, here are my suggestions:
-
First get incoming call recording properly working normally without a background service.
-
You have actually missed out on a few core concepts which the extension works on.
You are not the only one and I dont fault you for this, I believe documentation isnt so beginner friendly (I'll have to work on a more comprehensive documentation when I get time).So one of the things you can do right now is, go through the earlier posts in the topic or perhaps try some simple examples with Itoo, maybe you can try creating a background process that will play a music every 10 secs? You could also try guides related to extension β like the Battery Checker by @Taifun
Hello @Kumaraswamy ,
You have provided the AIA file codes for the application under the title "Battery checker reminding you to unplug when fully charged."
After I installed it on my phone, I realized that the application doesn't work when I close all the applications like in the pictures.
Isn't there a detailed training series about the Itoo extension? I'm new and can't understand it very well.
Thank you for your attention.
I would need more details, can you tell me about your Android version, device name and model? You actually have to click the Start Process button (which I assume you did)
Unfortunately there isnt any detailed training series on the extension. I can understand your problem, It's really hard for beginners to understand how the extension works...
Only thing you can do is look at what other's have done in the pasts by exploring previous posts.
You can also check at extension references below the first post:
You'll get some examples and guides demonstrating the use with Itoo extension there.
@Kumaraswamy
I pressed the start button in the battery charging application, of course.
It was working while the application was open. However, it didn't work when I closed all the applications.
And I'm sharing a screenshot of the information related to the phone. I will also examine the sample applications you sent.
Aha, it's Xiaomi
You may need to turn off some by default enabled battery optimizations on your device: Xiaomi | Donβt kill my app!
Check for device's battery optimization and app specific optimizations.
Do you see the notification still exist when you close the app?
no, when I close all apps, the notifications on the screen are turned off.
Can you please send me a short screen recording of that happening? You can message me privately by clicking on my profile.
Hi, @Kumaraswamy , I created an app that plays sound when new order is received as notification in our phone.
Now it is time to include Itoo extension as well. Can you give some tips?
My Plan: To create an app that gives continuous alarm sound whenever new-order-notification-email is received in phone. I am using ecwid.com to sell products online, so whenever new order is placed by customers, Ecwid will send new email notification about the order to me.
Give me some tips to use Itoo extension more efficiently in this app. Thankyou.
Okay, since you've got that working normally in background, here's what you can do to turn it into a background mechanism.
- DONT start directly, first play around with the Itoo extension with some examples you may find in this topic.
- After you are a bit familiar with the Itoo extension (first you must know how the extension works before you actually directly use it) then you can start converting your blocks into background functions to work with Itoo.
After only you have tried something and get stuck (not knowing what to do) you can ask for help here.
Okay.
your solution does not really work, see also my answer here Is it possible to make an app that notifies me with alarm sound when I get new mail from specicific email id? - #22 by Taifun
Taifun
I am just learning about itoo, and I have a few more questions:
The first regards clarification (and a possible suggestion) regarding the RegisterEvent block...
- Register events
eventName
: component name and event name combined, likeClock1.Timer
.procedure
: procedure called when the event is invoked with the args.
I was having trouble until I named my app's "procedure" to be called on the event occurrence to be the same name as the name of the event. For example in the case of eventName: "Clock1.Timer", the procedure: must be "Timer". If that is true, perhaps this be further explained in the extension description. While I noted that this is the way it is done in the example, it did not occur to me that it was necessary
[Actually, if this IS the case, could you just eliminate the "procedure" parameter altogether and get it internally by parsing the eventName parameter?]
The second question regards the itoo DB vs. the standard Tiny DB component.
- They are like Tiny DBs of Itoo, these blocks can be used in the background services, especially for non-foreground services to store and fetch properties. They provide special connectivity between services and and the application realtime.
Besides the convenience of having data items closely associated with its itto object, what is the advantage of using it (FetchProperty/StoreProperty) vs. using a separate Tiny DB? Can't a regular Tiny DB be used in non-foreground services? Isn't it available to both the app foreground and non-foreground threads/processes?
Kind regards,
Randal
This is not true, you can use any name, but the arguments must be the same as the original event... The Clock1.Timer event does not have any arguments but for example the Web1.GotText event has 4 arguments
TinyDB relies on SharedPreferences, this causes synchronization issues. That means when a value is updated from the App, it doesn't necessarily mean the changes will reflect in the background process.
To solve this issue, Itoo offers a Store/Read functionality similar to TinyDB to combat this issue
Taifun
Thanks for taking time to answer.
as you knew, I had other problems ... I have now happily renamed my Timer procedure to TimerEventProcessing
Thank-you for the explanation. I was trying to reuse some TinyDB code segments. I shall switch to itoo's FetchProperty/StoreProperty DB facility.
-Randal
... if I may ask one more related question:
Is a global variable that is written by a foreground app available to the background process? And vice-versa: is a global variable written from the background available to the foreground? Subject to synchronization? Where could I read things like this about foreground vs. background processes and their interaction / communication?
-Kind regards,
Randal