• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

android location loading weird locations

 
John ortega
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
so im currently trying to develop an android app that takes pics of trees and marks them on a map in the users location. im having 1 problem with my locations. Every time i boot up the app it shows a location i have never been to. infact everytime i start the app it shows me at the rose bowl , which i have never been to lol. somtimes it will also show me at my house when im at school. i have no idea how to correct this. if i hit the my location button it finds my current location and everything works fine. its just that initial load were it loads some random location for me. my code for the location is below. id like it to initially load my current location when the app boots up, is this possible?

 
Darryl A. J. Staflund
Ranch Hand
Posts: 314
2
Android Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This happened to me too -- I'd start my app and find myself positioned somewhere over Africa or something. The way I solved it was to set the bounds of my map in the onMapLoaded method as follows:



Are you able to do something similar in your map?

Darryl

NB: I found that if you try animating your camera to a single coordinate on the map, the camera would be so low to the ground after animation that you can't really see anything of the surrounding area. So if you're working with a single coordinate instead of a bounded area of two or more coordinates, you might also want to set your zoom level to a value that allows for appropriate viewing of the surrounding area.
 
Darryl A. J. Staflund
Ranch Hand
Posts: 314
2
Android Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi again,

I just learned of an easier way of doing this and wanted to post it here. If you've defined your map using a fragment similar to the following:



then you can declaring the starting map position right in the fragment definition as in the following:



Very nice!

Darryl
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic