Bug with MapView.retainState() and MapView.restoreState()

Discussion created by jbuckland55@gmail.com on Feb 7, 2013
Latest reply on Apr 25, 2013 by doneill-esristaff
I'm experiencing what appears to be a bug with MapView retainState and/or restoreState. When I call retainState() I get back a string like the following "-1.2471800881220436E7 4953487.459564156 29.294122036046193 1". Now, since the meaning of this string is undocumented, I'm taking some guesses here, but that last "1" seems to indicate whether or not you have a location service running.

However, when you restart your activity and then call restoreState passing in that string, it seems to turn on your location service AND setAutoPan(true)!! It does this even if you never got a location service from the map, or if you got one and explicitly setAutoPan(false).

If the meaning of that last "1" is actual whether or not to autoPan, retainState seems to be setting it to 1 if you have a location service started at all, autoPan or not.

In my use case, I have a location service running, autoPan to false, and am calling retainState on onPause. I then call restoreState on 'map initialized' (listening for the maps onStatusChanged where status == STATUS.INITIALIZED). This forces autoPan on, with no way to turn it off.

My solution for now is to change that final "1" to a "0" before I store it in my local preferences, so that autoPan is not turned on when I restoreState. Please let me know if i'm "doing it wrong", of it any other information would be helpful.