iOS Question [B4XPages] B4i Alarm

RauchG

Active Member
Licensed User
Longtime User
Hello everyone,

I'm working on a CountDown app. With a CountDown, the date and time are counted down using a "timer1_tick". If the date and time are less than / equal to <= than now, an alarm is to be triggered. The app is in the background and should be woken up or a notification should pop up.

Here is an example that "LocalNotifications" works. It works if you click on the "btnNotification" button. The app can be in the background and the notification pops up.


Is it possible to trigger the event not by clicking on the button, but by a "timer1_tick" event?

In my app, a toast "hd.ToastMessageShow (lblcdName.Text &" has expired ", False)" works via the "timer1_tick".


Greetings RauchG
 

Attachments

  • CountDown.png
    CountDown.png
    90.5 KB · Views: 237

RauchG

Active Member
Licensed User
Longtime User
Why not calculate the expected time and schedule the notification to show at that time?

I have now taken a different route. In the CustomListView I show an alarm button. This activates

ln.Initialize (DateTime.Now + (mLongFromNow) * DateTime.TicksPerSecond)

mLongFromNow = the calculated seconds

The notification works. But only with a countdown. If I want to call two CountDowns, only the last one becomes active. It is also clear because the last calculated time is transferred. The first ContDown is ignored.

I am now trying to write the different calculated seconds in a table and to transfer the smallest value, when the notification became active, delete and transfer the next value.

Could that work?
 

Attachments

  • IMG_0011.PNG
    IMG_0011.PNG
    278.5 KB · Views: 240
Upvote 0

RauchG

Active Member
Licensed User
Longtime User
Multiple notifications should work. You are doing something wrong. Note that by default the notifications will only appear when the app is in the background.

I'll try a table. Or is there a better way to save the seconds for multiple notification?
 
Upvote 0

RauchG

Active Member
Licensed User
Longtime User
Not sure that I understand.

For multiple notification I get several values (seconds) for mLongFromNow.

ln.Initialize (DateTime.Now + (mLongFromNow) * DateTime.TicksPerSecond)

I have to save these values somewhere. I'm thinking of a table or is there a better way to save the values (seconds)?
 
Upvote 0
Top