• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Overlay Map in the Background

idiot2k1

Lurker
Hello There,

I am writing an app that will track the user via GPS and create a path on my MapActivity to show where they have been. The problem for me arises when the user navigates back to home to use other functionality of the phone.

I am looking in my LogCat and it seems my process is dying when I access the Browser, for example. It ceases to work when I am driving and listening to music, but only after a period of time with no other action by me to break it.

The way my MapActivity is set up has been with the launchMode of singleTask and singleInstance, both with the same error occurring. I am running a Runnable from the start of the MapActivity to take care of gathering the GPS location and placing a blip on the map, the runnable is also placed on a new Thread.

Would there be an easier way to do this? Should I somehow create a Service that takes care of the location and blip functionality? How would I prevent the process from dying, and is there a way to see why it is being killed?

(I was playing with Google Navigate, and I want similar functionality to how the GPS location and map state are saved, even when the user goes back to the home screen and messes with other applications.)

Thanks for your help,
-Adam
 
So I've been playing with my code and working on a few different ideas.

I have my service running, and everything is fine.

My question is how would I have my service affect the map activity that started it?
Affect in the sense that the map would get an overlay based on the GPS info grabbed by the service.

I have looked at AIDL and also broadcasting intents.

Broadcasting looks like it would be closer to what I would want, but how can I have the map activity act as a listener for the intent.

I can have the service get the GPS data, and my map activity is where the overlay is created, I just need to link the two together.

Thanks Much
 
Back
Top Bottom