How do I schedule an application to run after the application is in the background? I am trying to convert my B4A code in which I use a Service to start my application at a selected time.
I tried using local notification as below, but it does not start the application when the app is in the background
I tried using local notification as below, but it does not start the application when the app is in the background
B4X:
Sub btnNotification (alarmTime As Long)
Dim ln As Notification
ln.Initialize(alarmTime) 'alarmTime seconds from now
ln.IconBadgeNumber = 1
ln.AlertBody = "Alarm Time"
ln.PlaySound = True
ln.Register
hd.ToastMessageShow("Notification will fire in " & alarmTime & " seconds.", False)
End Sub
Sub Application_ReceiveLocalNotification (LN As Notification)
'this event will fire if the scheduled notification happend when the app was running
mediaPlayer.showPage
hd.ToastMessageShow("Notification arrived: " & LN.AlertBody, True)
End Sub
Last edited: