Android Question startAt

Tata Mapassa

Active Member
Licensed User
Longtime User
how to use the service startAt service to display a message at a specific time?
if datetime.time = "08:00" then
msgbox ("message", "title")
end
thank you
 
Upvote 0

MarkusR

Well-Known Member
Licensed User
Longtime User
you can open a activity with StartActivity or CallSubDelayed and show something there.
or for a short message ToastMessageShow.
 
Upvote 0

Tata Mapassa

Active Member
Licensed User
Longtime User
Thank you for your return. How to display a toastmessageshow message with the StartActivity or CallSubDelayed service
 
Upvote 0

MarkusR

Well-Known Member
Licensed User
Longtime User
instead of a message you can jump into a activity with StartActivity or CallSubDelayed

B4X:
Sub Activity_Create(FirstTime As Boolean)


    Log("Activity_Create")
    Dim p As Period
    p.Seconds = 10
    Dim time As Long = DateUtils.AddPeriod(DateTime.Now,P)
    Log(time)
    
    StartServiceAtExact(TestStartService,time,True)
    Log("..")

B4X:
Sub Service_Start (StartingIntent As Intent)
    
    Service.StopAutomaticForeground 'Call this when the background task completes (if there is one)

    ToastMessageShow("HELLO",True)

End Sub
 
Upvote 0

Tata Mapassa

Active Member
Licensed User
Longtime User
I have the following error messages:
-variable not declared "service" it is used before having assigned a value to it.
-variable not declared "teststartservice" it is used before having assigned a value to it.
thank you
 
Upvote 0

MarkusR

Well-Known Member
Licensed User
Longtime User
i made a service TestStartService, there you find Service_Start event, see project/add new module/service module
and i started it from a activity in Activity_Create for testing
 
Upvote 0

MarkusR

Well-Known Member
Licensed User
Longtime User
me thought u started the service "at" 8 o clock so why u will check that again?
 
Upvote 0

Tata Mapassa

Active Member
Licensed User
Longtime User
in your example "Dim p As Period
p.Seconds = 10
Dim time As Long = DateUtils.AddPeriod (DateTime.Now, P) "
I do not see the part about the time "08:00"
 
Upvote 0

MarkusR

Well-Known Member
Licensed User
Longtime User
that was explained at post #4 in the link
 
Upvote 0
Top