0

I'm developing native BLE android app where I need to constantly remain connected with BLE device. Along with BLE, I also need to track GPS all the time until user doesn't logout. Here are my concerns

  1. Can we keep multiple service in foreground? In my case it has to be BLE and Location Tracking.

  2. I have seen that service getting killed though it is started using StartForeground in service onCreate. Is there any solution that can help me to keep my service alive all the time?

  3. I'm using START_STICKY in onStartCommand, though it gets killed in the background after long time.

  4. I'm writing characterstic using BluetoothGatt to send command to BLE device, I have multiple command to execute, is there any way I can know which command was executed from the response or I need to use flag variable to track the command request?

Please provide suggestions as I'm new to BLE feature.

moDev
  • 5,248
  • 4
  • 33
  • 63
  • I have tested on two devices so far and it is getting killed when device is idle for long time. Xiaomi and Samsung – moDev Aug 03 '19 at 19:47

1 Answers1

-1

for foreground services are you showing notification to the use for ongoing running services? If not then show a foreground notification that will be removed once the service is done.

Bipin Tiwari
  • 320
  • 3
  • 13