mohammad be
Member
Hello to all
This is my code in a service
But in Android 8, when the user deletes the program from memory
The declaration remains, but the order
StartServiceAt (me, DateTime. Now 30,000, correct)
Does not work
This is my code in a service
But in Android 8, when the user deletes the program from memory
The declaration remains, but the order
StartServiceAt (me, DateTime. Now 30,000, correct)
Does not work
B4X:
#Region Service Attributes
#StartAtBoot: True
'#StartCommandReturnValue: android.app.Service.START_STICKY
#End Region
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Private nid As Int = 1
Public Wsh As WebSocketHandler
Public WshLink As String="ws://45.156.xxx.xxx:xxxx/ws"
Public WshID As String=""
Public WshStatus As Boolean=False
Public GetChatAllStatus As List
Private pw As PhoneWakeState
Private rm As RingtoneManager
Private ringtone As JavaObject
End Sub
Sub Service_Create
Wsh.Initialize(Me,"wsh")
GetChatAllStatus.Initialize
pw.PartialLock
Service.AutomaticForegroundMode=Service.AUTOMATIC_FOREGROUND_NEVER
' Service.AutomaticForegroundMode=Service.AUTOMATIC_FOREGROUND_ALWAYS
End Sub
Sub Service_Start (StartingIntent As Intent)
Service.StartForeground(nid,CreateNotification("...",""))
StartServiceAt(Me, DateTime.Now + 30000, True)
SocketChk_Tick
End Sub