Medication Reminder (again)

Understood but I still don't quite understood how to make 'Do it' work...
Also, sorry for all the questions but wouldn't the instant that I stored be different from the one I get on those blocks (since the clock will give the instant moment and the one I store is introduced on the timepicker by the user)?

Install the companion app and use Do it to debug your blocks, see also tip 4 here App Inventor: How to Learn | Pura Vida Apps
see also Live Development, Testing, and Debugging Tools
Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by icon24 Taifun.

Is it this? I did the do it of the blocks you sent at 03:01 PM and the hours i introduced in the time picker was 03:03 PM...

Ok, you made some progress... very good...

Now compare the millis of the 2 instants or the FormatDateTime of the 2 instants
You will find out, that the date part of the timepicker instant is missing... to be able to compare the 2 instants, you have to add the date therefore

The timepicker gives you only an instant of time, but not of datetime

Taifun

Soo... What do I have to do exactly?

Taifun

Let's assume, you like to get the instant of today, 3pm

Take the datetime of today which is 2024-06-13 00:00, convert it into the format you need (see the 2 options below) and add the time received from the timepicker, which is 3pm

As always there are several possibilities to do this

  1. convert both into millis and add the millis to get the millis of that datetime

  2. use one of the methods from the clock component to add the 2 instants to get the instant of that datetime

Let me suggest you to start trying something

Taifun

Isn't there a simpler way to send a notification to the person at the time she chose in the timepicker when she submits the medicine? Also, I visited the 'How to use the CLOCK' tutorial and didn't quite get it how it works... I even downloaded the .aia but it didn't show what I wanted to do soo...

To add a date and the time received from the timepicker to get the alarm datetime is a simple addition like 2 + 1, it does not get simpler...

If you only visit the clock tutorial without doing anything you will not learn much...

Start doing something...

Taifun


Is it something like this?

To find out what you are doing, convert the millis into a readable format using the FormatDateTime method

If you do this exactly at midnight, then yes ..
Remember:

Taifun

What should I change then?

Here is a small fish for you

remember to use Do it to debug your blocks
Taifun

Thanks Taifun, now finally the data is being stored correctly... Now can you show me the blocks that are needed to make the clock remind at that time?

Sorry... it is your school project... you have to do it yourself. ..

In the clock timer event check regularly, if the current time >= alarm time, then display a notifier

Taifun

I know but can you at least give me a headstart, at least how to make the clock start working? I can figure out the rest...

set Clock.TimerEnabled to true
Taifun

Do I put that block on after timeset on the time picker or when the button save is clicked? Or is it on the "When Clock1 timer do"?

What about trying a few things? Experimenting?

Sounds like a good choice

How can that event be triggered without first starting the clock?

Taifun


Would something like this solve my problem?

1 Like