Android Question How To Show Service When Activity Not Open

Muhamad Hendra

New Member
Hello all
I want to ask

I have a code like this in my service
B4X:
Sub Service_Start (StartingIntent As Intent)
    DateTime.TimeFormat = "mm"
    If DateTime.Time(DateTime.Now) = 22 Then
        StartServiceAt(Show_Notif, DateTime.Now + 60 * 1000, True)
        Service.StopAutomaticForeground
    End If
End Sub

and this is the code for the notification
B4X:
Sub Show_Notif
    Dim n As NB6
    n.Initialize("default", Application.LabelName, "DEFAULT").AutoCancel(True).SmallIcon(smiley)
    n.Build("TRY NOTIFICATION", "Shows the 22rd minute", "tag1", Me).Notify(4) 
End Sub

so, I want to show a notification when two conditions:
1. minutes indicate the number 22, and
2. when the activity is closed or not open or not clicked

please help me, I have searched everywhere, but my problem has not been solved

thank you
 
Top