Can I make an app that alerts the user of the time to review?

I’m making an app to memorize words.
After 10 minutes of learning a word, I want an alarm to sound and a notification window to appear.
This is a feature that tells you the time to review.

I want the app to run in the background. Is this possible in thunkable?

I’ve made a timer that counts down, but when I press the Home button to turn off the app, the timer doesn’t work. Open the app and it will work again. How can I make my timer work all the time?

After memorizing words, I would like to sound the alarm 3 days later, 7 days later, and 30 days later.
How is this possible?

1 Like

No, Thunkable doesn’t run code while in the background. You could have a timer that goes off after 10 minutes of using the app (in the foreground) or you could check to see how much time has elapsed when the app is re-opened – this latter method I’ve been trying to get working but haven’t figured out yet. :face_with_raised_eyebrow:

You may want to use “Push Notification” component. Which let a lot of filter such as location, time, a range between two things.

I’m curious how that would help. You would still need a way to determine that 10 minutes had elapsed while the app was in the background.

What do you mean by “filter… time”? Do you have a link that explains that? Thanks!

You need to use "push notification"and “web api” components.

And check this link.

1 Like

Onesignal doesn’t seem suitable for my app.
When a user learns a word, they need to register five notifications. When a user learns 10 words a day, 50 notifications must be registered. As the number of users increases, the number of notifications increases exponentially.

In addition, when offline, notifications do not come because of learning failure occurs.
I hope the notification works well even when offline.

Is there any way at all?

It’s a pity that the background doesn’t work. I can’t create the app I want.

I can only implement it by checking how much time passed when I reopened the app and deciding whether or not to show word problems.

How can I check the time when the app is reopened and how long it has passed?
And how can I activate or deactivate words based on this time?

I think I have a way to determine the amount of time an app has been in the background. I’ll upload a demo tonight or tomorrow morning, assuming it works.

It involves comparing the amount of time the app has been open to a timer saved to the cloud to the number of seconds since 1970.

1 Like

Thank you.
The first time you click the cat character in the center of the screen, cat will disappear from the screen.

After 10 minutes, cat will appear on the screen.
Press cat to make cat disappear from the screen.
The day to review is stored on local storage.

cat is
Appears after 1 day, 3 days, 7 days, 15 days, and 30 days.
The screen on which cat disappears shows how long it will appear on time and date.

Coding the above roughly includes all the methods I want.

I’m getting stuck because I can’t make a reliable timer. Once this is resolved, I should be able to finish the demo for you:

1 Like

this would be incredibly helpful!

In the meantime, here’s the algorithm I was going to try.

The idea is that the appTime is a countup timer (which is why I need it to work properly) that gets reset to 0 every time the app is opened. The elapsedTime is the difference between the number of seconds since 1970 and the startTime (which gets set at first run).

If the app was just opened/re-opened, appTime should be zero and we check to see if the elapsedTime is greater than zero (which means the app was re-opened instead of opened for the first time; I guess I could also check the first run boolean value…). If it is, then we use the elapsedTime as the background duration that we’re looking for. That is, the amount of time in seconds that the app has been in the background before being re-opened.

1 Like

There is a Web API with which you can get the current time.

To check after 10 minutes is to check by time.
However, after 1 day, 3 days, 7 days, 30 days, etc., the check is based on the day.

So, to satisfy both of these conditions, it seems that the calculation method is based on the year, month, and day time values.
Isn’t it possible to use device blocks?

If you only calculate by time, you need to apply a formula that divides time by day.
Only then can you decide which day to show.

And with device blocks, don’t you need to calculate when you opened or closed your app?

I’m just starting to study this, so I don’t know what a good idea.

No, it’s best to determine time by using number of seconds since 1970. That way you’re not having to convert months and days and check for leap year and all kinds of other crazy things.

What I’m hoping to do is keep a timer running in the app and save the timer value every second. So if you close the app and then re-open it a while later, you can compare the “seconds since 1970” to the saved value from when the app was closed and you’ll be able to tell how much time elapsed between closing and re-opening the app.

The first time you click on a cat, it disappears.
The cat will appear after 5 seconds.

The second click will disappear.
Cats appear after 10 seconds.

The third click will disappear.
The cat will appear after 1 day.

I couldn’t find a way to add dates (year, month, day)
1970 blocks were used.
There is no background function but I used 1970 block
I can detect the passage of time even if I close the app.

1 Like

Can you share the blocks you put together to accomplish that task?

It’s crude.

Are you saying this app timer runs in the background or does the computation when the user opens the app again?

And are you indicating this code permit the app to alert the user when the app is closed?

There is no background and no notification.
It’s a way to calculate the time passed to 1970time when you close and reopen the app.