Background Tasks [4.1] πŸ₯³

I see this behaviour on some devices.
The system may stop the service as there is no interaction with the App.

Especially on high-end devices.
Also, can you please say me the components you are using? Are you using a clock for it?

no. Only web component with repeating alarm set to 120000 interval

Please say me your phone manufacturer name?

Hello thanks for looking in the matter. Actually i want to make a mesaging service for people within my house. like a family messenger and for media purpose I am using Airtable. and becuase its a messaging service i must call every second for this purpose. every 30 seconds or every 1 minute will be also great. can you help me sort out ?

ohh so it may lead to crashing ?? so what is the solution. I Cannot make it go upto 15 mins because

Please Say. BTW Great extention @Xoma

1 Like

You can alarm tasks for that. It has minimum latency of 1 minute.

If you don’t want the service to be killed and long-running, you should use foreground service with ACTIVITY_NO_KILL flag.

I really excited for 3.6 A update, with lot of new features.

@Xoma can you give SneakPeak about new 3.6 update?

2 Likes

thanks for looking into it.
Can you please explain with blocks if possible ? cause i do not know how to do this

if not then Thanks for your Help.

You will be able to get data from Airtable, but how are you going to clarify that this is a new message?


I am still doing some experiments, not started the work at all :laughing: :sweat_smile:
Planing a new way to do things.

1 Like

I will create a tiny DB With total no. of rows previously and call for new rows. then the condition will go :

if Totalrows = Tinydb getvalue : msgnum
then show notification(totalrow - tinydb get vaue msgnum) new messages
else: continue the background proccess

please say. How do i call airtable vaues using the extention i am a little confused how to use it ?
also please explain foreground process.

Also add SaveForBoot function block in new version.

Yeah please wait

Here is an example to call values from Airtable and show in a notification according to your way (checking the row counts).

I am using a clock just to demonstrate it with the interval of 7 seconds just for testing. You should increase it to like at least 25 seconds.

First, create the needed components. We will be reading the row count from tiny Db.

Then we will set the properties for the Airtable spreadsheet (i.e API key, base Id, table name) component with the Timer interval. Make sure to use the functionNames and names correctly.

Screenshot 2021-07-19 at 15-46-07 Kodular Creator

Then when the timer is fired, we will get all the rows from the spreadsheet.

Then we will create a variable with a default value from the tiny Db.
We will create another two functions which will update the row count in the tiny DB and one which will get a single cell.

We will register an event called GotAllRows and pass it to process1 extra function.
The extra-function block will check if the old row count and the current one. If they do not match, that means the row is updated.

total_rows != row_count

The above is a java command to compare two things.
!= means not equals to. If we return true, then we should call another function. If false is returned, it is ignored.

In case of true, we will call another normal function block called get single row. The parameters get passed as well from the extra event.

Screenshot 2021-07-19 at 15-55-22 Kodular Creator

Here we want to access the total number of rows from the event.
So, we will just write {%2}. This will get replaces with the value of totalRows.

{%<Index>}

The index of totalRow parameter is 3. But in Java, counting starts from 0, so we write it as 2.

At last, we will create a variable to store the value of the requested cell. Variable is initialized with an empty value.

When the cell is got from the Airtable spreadsheet, we will show it in a notification by {%1};

Screenshot 2021-07-19 at 16-02-53 Messages Table 1 - Airtable

And we get that working :hammer_and_pick: :partying_face:

AirtableDB.aia (503.6 KB)

Make sure to put your Airtable credential in the global variables.

Why? It is already possible :wink:

3 Likes

I can’t do it without your proper guidance, Your given guide is small for me to understand.

Don’t you understand this?

THANKS @Xoma ! U Helped me a Lot! I will surely Try that out and Mention in the About of my App
Please tell me if have an IG. I Will Follow you and Share the App once its Ready. @Xoma Hats off
and Thank you for the Explaination of Each Functionality .

3 Likes

What happens, if you reboot the device? Will the notification still be shown?

Taifun

1 Like

I just have missed one line more here.

Job Service will be started when the alarm.
I have not set it to persist.

No, it will not be shown.

I am trying to create a background task wherein if a button is clicked on the app screen and the app is then closed, any change in the proximity sensor reading will turn on the flash light. However when I click on the required button on the app screen and cover the proximity sensor the flash light does not turn on. Below are my blocks. Would be great if I could know where I am going wrong.