Android Question Serial acquisition in the background

Pesciolina

Active Member
Licensed User
Hello everyone, I would like to acquire data from the USB serial port even in the background, with Wifi and Ble it works perfectly having put the comand
Service.AutomaticForegroundMode,, how can I do for the USB device?

Thanks
Marco

B4X:
Sub Service_Create
    Service.AutomaticForegroundMode = Service.AUTOMATIC_FOREGROUND_ALWAYS 'we are handling it ourselves
    lock.PartialLock
   
End Sub
 

Pesciolina

Active Member
Licensed User
Hello Erel,

I did not put the Service.StartForeground command as it works with Wifi and Ble. With the Usb after four minutes it no longer updates the db, however as soon as I reactivate the app the records are written of the db and sent on the web. I saw your Mylocation example but I don't know how to apply the StartForeground command

Thanks for your help
Marco
 
Upvote 0

Pesciolina

Active Member
Licensed User
Hi Erel,
I did tests with several smart phones and up to the Android 8 version the background reception and sending works correctly. Mine is a Huawei Mat20 pro with Android 10 and as I wrote earlier, after 4 minutes it doesn't transmit anymore. How can I solve this problem ?
I have not written to you that the App is for sdk 19 as it was made a few years ago because it had to run on Android 4.4

Thanks
Marco
 
Upvote 0
Top