Android. Perform independent process to the activity

0

In the MainActivity my APP has a button to open a Google Maps activity and show you some coordinates that you receive from a Raspberry Pi. The problem is that I do not know how to make the coordinates update while the app is still working.

That is, make an independent process that updates the coordinates every X minutes. I've tried with a

  

Service

but it does not work because the service does it once and I have to call it again, and if I put a loop inside the Service, the APP stops because the Service is running and ignores the OnClickListener of the MainActivity.

What can I use to keep the APP waiting with the setOnCLickListener for example to open the Maps and in the meantime update the coordinates of the raspberry with a certain period of time?

Are those threads? Subprocesses? I have no idea what I can use.

I do not know if I have explained myself well, ask me if you have not understood something, I will answer as soon as possible. Thank you very much.

    
asked by wasous 25.05.2017 в 10:32
source

1 answer

1

I suppose it would be to use an IntentService that is nothing more than a thread that executes a certain task in a thread independent from the main thread of the application.

I recommend that you see this tutorial that I followed.

link

    
answered by 25.05.2017 / 11:21
source