Ongoing Notification Opening Map

Put problem concerning MapActivities, MapViews, Overlays and GPS in this forum.

Ongoing Notification Opening Map

Postby idiot2k1 » Sun Sep 12, 2010 11:41 pm

I have a MapActivity that runs a Runnable that blips the map with the user's location. Over time this will create a path to show where the user has been. I also have an ongoing notification running so the user has the ability to reopen the map to see the current path, after navigating through the OS (music, browser, contacts...) if they need to do so.

My problem is that over time if the user clicks the ongoing notification to return to the MapActivity it creates a new map, which deletes all the blips that were there. The Pending Intent is created from the same Intent initially called to create the Map Activity, and it has the launchmode set to singleInstance.

I can't wrap my head around what is happening, other than it is not working correctly. Is the stack being messed with and then when the user brings the Map Activity to the front the stack can't find the original Map Activity, or is it something else that I am missing? Should I somehow have the blip function run in a Service to run in the background? (How would I do that, and would that retain the state of the overlays on the map the way I want?)

Thanks,
Adam
idiot2k1
Freshman
Freshman
 
Posts: 9
Joined: Wed Jul 14, 2010 2:58 am

Top

Re: Ongoing Notification Opening Map

Postby idiot2k1 » Mon Sep 13, 2010 12:23 am

While testing my app I will have the MapActivity running, with the ongoing notification and blip Runnable working perfectly. I will go to Home and then try to run other apps. While reading the LogCat I can see that the process seems to die when I open other processes. I have my Runnable on a new thread...so I think it should still work.

Is there a way to prevent the process from dying, or at least alleviate the problem?

Edit:
Maybe, as a workaround, would there be a way to save the Overlays and then when the Map Activity restarts just repopulate them on the map? Would there then be a way to check to see if the map is being restarted after a crash vs. a new instance of the map?
idiot2k1
Freshman
Freshman
 
Posts: 9
Joined: Wed Jul 14, 2010 2:58 am

Top

Return to Map Problems

Who is online

Users browsing this forum: No registered users and 2 guests