Hi Erel,
Thanks for the reply.
We have a lot of apps that are using Service.StartForeground but can't actually run them on our test Samsung S7 phone running Android 7.0 if we re-compile them with the current version of B4A. Each app crashes as soon as Service.StartForeground executes. All of our apps that were compiled with the previous version of B4A will not crash when run on that phone.
Maybe the crashing is caused by the other issue we have faced with using notifications after compiling with the current B4A version. That issue crashes our test phone as well. We were able to do a work-around by initialising the notification every time it's used like in the following code in which case does not crash the app:
In a sub routine.
nNotify.Initialize
nNotify.Icon = "icon"
nNotify.Sound = False
nNotify.Light = False
nNotify.Vibrate = False
nNotify.SetInfo("Our App", "Our message.", "")
nNotify.Notify(2)
In our original existing apps, we initialised nNotify first and re-used the notifications like this:
Service_Create:
nNotify.Initialize
nNotify.Icon = "icon"
nNotify.Sound = False
nNotify.Light = False
nNotify.Vibrate = False
In a sub routine:
nNotify.SetInfo("Our App", "Our message.", "")
nNotify.Notify(2)
In a another sub routine:
nNotify.SetInfo("Our App", "A different message.", "")
nNotify.Notify(2)
We already tried to initialise nNotify prior to using using the following without success:
Service.StartForeground(4, nNotify)
wakeState.PartialLock
The app runs only if we comment out the StareForeground statement.
Is there an alternate statement we can use to start the service in foreground mode?
Thanks.