Notification with device sleeping

ciginfo

Well-Known Member
Licensed User
Longtime User
Hello.
i use startserviceat to send notification00s. but it does not work when my appli is not in activity.
I try with SartServiceAt(" ", , True or False) it does not work.
What is the soluce?
Thank you
 

ciginfo

Well-Known Member
Licensed User
Longtime User
When i code like you say, notifications go on to be sent when i shut the appli. But if i shut the activity application with the " gestionnaire des taches" , notifications are not sent.
I see in others applications installed on my smartphone, that notifications go on to be sent when appli is shut with the task manager.
 
Upvote 0

ciginfo

Well-Known Member
Licensed User
Longtime User
In Main Module
B4X:
Sub BtnBack_Click

   DateTime.TimeFormat = "HH:mm"
   MyHeure = DateTime.Time(HeurePilule)
   
'Enregistre la coche
If ChkNotif.Checked = True Then
   notif = True
Else
   notif = False
End If
'Enregistre le mail
mail = EditParamMail.Text

  Dim List1 As List
  List1.Initialize
  List1.Add(datePilule)
  List1.Add(heurePilule)
  List1.Add(marquePilule)
  List1.Add(classeOP)
  List1.Add(notif)
  List1.Add(mail)
  File.WriteList(File.DirRootExternal,FileSETTINGS,List1)
  
 'Lance la notif si coché
  If ChkNotif.Checked = True Then
      'StartService(Alarme)
      StartServiceAt("Alarme",DateTime.TimeParse(MyHeure),False)
      'StartServiceAt("Alarme",DateTime.TimeParse("20:45:00"),True)   
  Else
   'StopService(Alarme) 'Met fin à la notif
   CancelScheduledService(Alarme)
  End If

Dans Service Module
B4X:
Sub Service_Start (StartingIntent As Intent)

RECUP_alarme
Dim n As Notification
n.Initialize
n.Icon = "logo"
n.SetInfo("Contraception", alerte, "Main") 
n.Vibrate = True
n.Notify(1)

'StartServiceAt("",DateTime.Now + (24 * 60000),True)  'Tous les jours
StartServiceAt("",DateTime.Now + (30000),True)  'Ttes le 30 sec pour essayer

End Sub
 
Upvote 0

ciginfo

Well-Known Member
Licensed User
Longtime User
OK and Thank you for your answer.
But How to solve the problem. It is imperative that notifications are sent even if task manager closed the application.
 
Upvote 0
Top