[Discontinued] Background Tasks [4.1] 🥳

How to run a sensor-based app in the background? Like I want to run Accelometer in the background to get values?

Hello, @gdeveloper

You can take a look to the post above, which includes pedometer sensor running in the Foreground service and accordingly it’ll send the simple steps event value to the firebase.

You may change the event and the component and try running it.


And a note to everyone:

Do not name the function Id with any upper case letters, If you will be using with the ExtraFunction Id, it will not work because of a bug.

Hello. Last time I successfully received the firebase data and displayed it in the notification. Now I want to fetch data from firebase then save in tinydb. But no data is saved. How to fix it?
The notification (data:data) is always " "


Thankyou

Hi,

I’ve found the following mistakes in you’re blocks.

  • You have named the initialize function Name initialize which should be Initialize instead.
  • You’re registering the event late so it might not be triggered at first.

Also you’re blocks looks messy, what are you actually trying to achive?

@Xoma Im trying to save firebase data on tinyDB every data changed. Then show notification from tinyDB every hour.

Did you solve this?

Yeah, and the problem still exist

I will check it… later…

1 Like

I think the problem is in create variable function or get value function (tinydb). its need to restarted to get latest result.

After restart the app

Hello,

I’ve prepared this demo file that will store the firebase changed value into a tiny DB. After the clock interval is raised (I’ve tested with 30 seconds interval) It will get the value from the tiny Db and it will show it in notification (notification-style) extension.

But as you told me that it should show every 1 hour, but if the system kills the service if there is no user interaction with the app.

Next updates include a feature, that can say the system if the services should try to start again after killed by the system. And will include a simple way to handle invoke values or the return values of the blocks like (tiny DB get value).

Below, I’ve attached the project file, do get confused :sweat_smile: the blocks are large.
You should change the firebase token, API key and the interval through variables.

NotificationTinyDB.aia (468.5 KB)

Note that tiny DB will only store the latest value.
Also, next time, try to do it you’re self :sweat_smile:, If everyone ask me, I cannot reply quickly or I’ll get time.

4 Likes

Thankyou its worked :grin: :grin: :grin:

1 Like

does this extension supports extension or only components also???

2 Likes

extensions also

3 Likes

A new update for the extension will be released tomorrow or in a few days. :grin:

3 Likes

Is there any chance you will update these symbols (<,<=, >, >=, !=) to compare numbers? :grin:

1 Like

Actually it’s the correct/efficient way to do things.

The current way also allows you to do more things rather than just comparing values.

Like you can compare the Java statements and the event value

System.currentTimeMillis() >  Integer.parseInt({$0}) :: function(some-id)

As the example above you can do more things than only comparing with constant values.
Here we check the time accordingly and call the value.

2 Likes

Background Tasks 3.2 A

As time passes… The extension gets better and better :smiley:
So here is another update for it!

There is a total of 3 new blocks, 3 bug fixes and 3 changes!

(Click on the image to expand it.)



  • New blocks

    Reset

    • Clears the task list (the functions/create components) or resets them.

    30.06.2021_21.05.52_REC

    • Returns the list of currently running or pending service IDs list.

    30.06.2021_21.07.29_REC

    • When the service is killed, this property block will be to indicate if the service needs to start again. The restart time depends on the System.


  • Fixed issues

    • Fixed an issue where if you had entered any function that has Caps in it, the function would be failed to call.

    • Fixed an issue where the service would stop after some time after the app’s screen goes off.

    • Now the service will run/start even if the phone is booted or restarted.



  • Internal/Blocks changes

    • Finish task block updated with the boolean value to indicate if the service should start again.

      FinishTask

    • A new way to call functions and return their invoke or the return values directly. This can be used through the MakeExtra block as (invoke:[FUNCTION_ID])



    • Now the extension does a quick validation of tasks to prevent empty tasks from being sent to the service.



Download the new version (3.2 A) com.kumaraswamy.tasks.aix (455.2 KB)

If you find anything wrong, please let me know :smiley:

10 Likes

The new repository for the extension’s sources are here :partying_face:

The extension is created with Rush by @Shreyash!

6 Likes

Maybe that’s why you are Rushing :running_man: to give the Extension new updates :grin:

4 Likes

Please, what is wrong here?

I’m trying to retrieve a source link via the web component, then compare if the value contains “not found” it makes a notification, and if it doesn’t it does another one…

** I tried the method with firebase, and it worked…