[Discontinued] Background Tasks [4.1] 🥳

I am trying it but it’s not working :roll_eyes: :roll_eyes:

@Xoma Here is my firebase DB data
image
“Waktu” is a string value. But the notification shows “18”.
I dont know whats wrong

It’s because you have not stored the value in a proper way.
If your value contains a special character or the value is a string that it must be stored in this way​:point_down:

"\" Your value\"'
1 Like

The notification style component doesn’t work. Just wait, the new version will support it!

1 Like

@Xoma Owhh my bad, the data was send by arduino. im gonna change the arduino first.
Thankyou so much for your explanation

1 Like

Extension 3.1 A

:smiley: The new version is ready and includes the below changes:

  • Extension is now more likely to work with components like Notification style and other things :grin:.

    It was my mistake actually… When the Notification style extension has called (.getClassName) while preparing for the start value for the notification, it would be null and it could not function.

  • Added support towards comparing objects/boolean values (true/false) and others like a string when any registered event is raised.

    Here is the usage of the new component ExtraFunction. It’s the same as a function that will compare the texts and if the result is true it will call another function. It basically filters values.

    Wherever you will use {$0} in the Extra function block that means the event values, its the same as the function block which replaces data.

    For the function to know (differentiate) if the function Id is extra functions or the normal functions, you’ll need to add the dollar symbol before that.

    To compare strings you should use "anotherstring".equals("comparingstring") or the equals segment. To compare numbers or true or false values you will have to use the = symbol twice like ({$0} == 7). Suppose the {$0} is the event value which means 7 the extension will replace and will compare it like this 7 == 7 and the condition is true so it’ll execute the function.

    After the comparison, put a space and put :: with the function inside the function Id, then it’ll call the function, below is an example of how it works.

    Also make sure not to put many spaces or the extension will fail to understand it.
    The extension can also execute multiple items (provided as list). So you’ll be able to call many functions as well.

0 event value: "77" (this is string and NOT number)
functionId: "show-notification"


"{$0}".equals("77") :: function(show-notification)
"77".equals("77") :: function(show-notification)
true :: function(show-notification)

(now the result is true so it will call the function id 'show-notification')

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

  • Download demo AIA file to work with notification style and with filtering the Firebase data change:

    FirebaseFilter.aia (467.8 KB)

    Make sure to update firebase token, and api, also the extension will only listen to the only tag text. You can change the value in the extra function block.

18 Likes

Great extension !!

what is more, it’s for free!!

thank you !!!

4 Likes

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