Search code examples
androidandroid-activityservicegpsandroid-things

Android-Things GPS Service bound to main activity or separate activity?


I am developing code for simple robotic automation on Android-Things using GPS and a number of sensors (magnetometer, gyro, accelerometer, camera, etc.) and outputting signals to a number of motors.

Having that in mind, should I setup the GPS et al. as bound services to the main activity or bound to their own activity, or some other method?


Solution

  • Use an activity if there is user involvement (button clicks etc). Use a service if it should run in the background.

    Depending on your case, if the user wants to turn the service on, you may have a button starting the background service and activity destroys itself.

    Can you be clear about how the flow should look like?