Android Question App dosen't work without USB-Cable

alexOdysseus

Member
Licensed User
Ich weiß nicht mehr weiter. Das Programm läuft fehlerfrei im Debug/Release Modus. Doch sobald ich das USB-Kabel entferne, funktioniert es nicht mehr. Mir geht es hier um einen Veranstaltungskalender der statisch an zwei Tagen Benachrichtigungen senden soll. Getestet an einem Samsung S7 Android 8.0.0, B4A 8.80

I do not know how to continue. The program runs error-free in debug / release mode. But as soon as I remove the USB cable, it does not work anymore. This is about a calendar of events that should statically send two days of notifications. Tested on a Samsung S7 Android 8.0.0, B4A 8.80

Code Snip:
Sub Service_Create
Service.AutomaticForegroundMode = Service.AUTOMATIC_FOREGROUND_ALWAYS
Public PhoneWake As PhoneWakeState
'PhoneWake.KeepAlive(True)
PhoneWake.PartialLock
End Sub

Sub Service_Start (StartingIntent As Intent)
Dim zeit As String
Log("ich habe Samstag gestartet. Ich habe meinen Job gemacht und warte auf die naechste Zeit.")
zeit = DateTime.Time(DateTime.Now)

If zeit = "10:00" Then
Log(zeit)
Dim n As Notification
n.Initialize
n.Icon = "icon"
n.SetInfo("Nächster Event: eins","" , "")
n.Notify(1)
End If

Dim tt As Long = FindNextTime(Array As Double(10, 10.08, 10.18, 10.25, 10.33, 10.42, 10.50, 10.58, 10.67, 10.75, 10.83, 10.92))

Log($"Next Servicetime is: $Time{tt}"$)
StartServiceAt(Me,tt,True)

Service.StopAutomaticForeground
End Sub
 

alexOdysseus

Member
Licensed User
OK, this should be an information app for a local Harley event. The user should be informed, when the next band is on the stage. And for this, a notification will be popup. In my test every 5 minutes. You can also tip on a row and a picture comes in front and you can resize it.
With hyperlinks to several pages. Everything work fine, when a cable is pluged and so in charging mode, no matter if the display is on or not. But when I install the app and unplug the cable, only the first notification on the next timetable pops up and that's it. No error, nothing. You can view the pictures click on the lnks, everything works, but no notification.

In my eample, I remove the pictures, because it's too big.
 

Attachments

alexOdysseus

Member
Licensed User
Now it works! I think the most reason for this is the line:
sNotif.Initialize2(sNotif.IMPORTANCE_HIGH)
that will bring the message in front.

Thanks a lot!!
 
Top