StartServiceAt everyday

ciginfo

Well-Known Member
Licensed User
Longtime User
I rephrase my question differently.
My application needs to send a notification every day at the same time.
But it is the user of the application who must set the time of sending.
I code
In Main Module
"HeureAverto" is a long which represents the time chosen by the user
HTML:
Sub ChkNotif_CheckedChange(Checked As Boolean)
If ChkNotif.Checked = True Then
    MyHeure = DateTime.Time(HeureAverto)
    StartServiceAt("Alarme",DateTime.TimeParse(MyHeure),True)
End If
End Sub

In Module Service
HTML:
    Sub Service_Start (StartingIntent As Intent)

         Dim n As Notification
         n.Initialize
         n.Icon = "logo"
         n.SetInfo("Contraception", alerte, "Main") 
         
         n.Vibrate = True
         n.Notify(1)
      
   StartServiceAt("", DateTime.Now + 60000 * 60 *24, True) '24 hours after
   
End Sub

The problem is: If the user chooses the time of notification for 12 h00 (HeureAverto) but if he makes the setting at 17 hours, the service starts every day at 17 hours and not at 12 hours as it should.
This because, if this time chosen has already past the service will be started now.
Do you understand me?
 
Top