If you want to use a service or a receiver the shorter period for calling it with StartServiceAtExact or StartReceiverAtExact is 30 minutes. You also have to add in manifest the proper permissions (check the forum as I do not remember them at all).
My timer often stops running, download it to help me fix it, thank you
CallSub(Main,"Service_ShowTimer")
change to CallSubDelayed, now it's ok,thank you
if my sub no agrmemuent,how to CallSubDelayed(main,"Service_ShowTimer",null?) or arry(null)?
B4X:
Private Sub btService_Timer_Click
StartService(Timer_FW)
End Sub
Timer_FW.bas
Sub Service_Start (StartingIntent As Intent)
'Service.StopAutomaticForeground 'Starter service can start in the foreground state in some edge cases.
Service.AutomaticForegroundMode=1
timer1.Initialize("Timer1", 1000)
timer1.Enabled = True
End Sub
Sub Timer1_tick
pubbas.TickCount=pubbas.TickCount+1
Count2=Count2+1
If pubbas.Activity_Show=True Then
CallSub(Main,"Service_ShowTimer")
End If
End Sub
If you want to use a service or a receiver the shorter period for calling it with StartServiceAtExact or StartReceiverAtExact is 30 minutes. You also have to add in manifest the proper permissions (check the forum as I do not remember them at all).