[Discontinued] Background Tasks [4.1] πŸ₯³

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.

Did the app crash?

I got a crash after some time it randomly starts to work. I will look into this.

Background Tasks 3.6 HOTFIX :partying_face:

  • [FIXED] Event issue which in some cases, for components like Proximity sensor the app would crash. This was because the event was fired too early for the extension to handle the event.

Nothing more than this fix :sweat_smile:


Download the extension: com.kumaraswamy.tasks.aix (468.3 KB)


You should update the extension to get it working. I got it right working in this version. First, try and check if it works with the app without closing it. I recommend turning on the foreground mode in the start service block. This will make sure that the service will be started immediately.

If you are using the version from 3.4, you can remove the CreateComponentsOnUi block. Also, the component clock is redundant. You can remove those two blocks.

The MakeDelay block is not useful here. This will just increase the waiting time. You can also remove it. You have set the requiredNetwork value to β€œANY” which is just not useful and will only work if the network is connected, so, set it to NONE .

4 Likes

Yes the app did crash after covering the proximity sensor a few times

1 Like

Was this solved in 3.6 version?

Thanks so much. Will try it out

2 Likes

There is actually more to do than just add a line of code.

1 Like

Oh ok
Just asked.

1 Like