Discussion Forums  >  Uncategorized

Replies: 9    Views: 542

WolfTimJ
buzztouch Evangelist
Profile
Posts: 810
Reg: Feb 20, 2011
Rockwall, TX
17,400
03/24/11 09:46 AM (14 years ago)

Easy way to show current location?

Looking for an easy way to have a one button that will show the phone's current Lat and Long. Ideas?
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
03/24/11 10:29 AM (14 years ago)
v1.4, v1.5, iOS or Android?
 
WolfTimJ
buzztouch Evangelist
Profile
Posts: 810
Reg: Feb 20, 2011
Rockwall, TX
17,400
like
03/24/11 11:29 AM (14 years ago)
All of the above. Thanks Dave
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
03/24/11 09:48 PM (14 years ago)
All of the above.. sigh. There are several ways to do this. It all kinda depends on what you're trying to do. Show a web-view, or simple text listing the users location? Show an alert or something that shows the current location, etc, etc. The solution will be different for iOS and Android and for the version you are running. And, your skill level and understanding of the project files will also relate. It's tough to say what the best way to do this is because there is no 'built in' way to do this using buzztouch. Hmm... Oh, wait... how about this: a) you create a single-location map view with a dumy locations (something that doesn't matter) b) When the map loads and the users location is tapped, a bubble shows with 'your location' text. Can't remember the text that shows without looking. It would be easy to change the source code in the project to show the users lat / lon in this callout bubbble. IF this makes sense, and you're willing to dig-in a little, I can work out a way and show you what to adjust.
 
WolfTimJ
buzztouch Evangelist
Profile
Posts: 810
Reg: Feb 20, 2011
Rockwall, TX
17,400
like
03/24/11 10:18 PM (14 years ago)
That would be perfect actually. Seeing where you are standing on the map would inspire confidence that the lat long is correct. FYI- this will be use by Paramedics at scenes to give the incoming helicopter crew an accurate location. BTW- Launching my first 1.4 app that's gonna make some money in a few days. Thanks for Buzztouch. I really could not have done it without you, really.
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
03/24/11 11:00 PM (14 years ago)
Cool. BTW, we're preparing to upload the newest release of the in-beta v1.5. This release includes a 'Location Report' screen. This is a simple screen that allows a user to see the lat / long, update it (if it's stale), then POST it to a URL. We'll get v1.5 for Android done as soon as we can! So... lets start with iOS v1.4. We need to make sure you can do this, then we'll do the same adjustments to Android. In Xcode, in your current project: a) Find the MapViewController.m file inside the Screen_LocationMap folder b) Scroll down to about line 375 and find this line: self.mapView.userLocation.title = @'You are here'; NOTE: FORUM DOES NOT ALLOW DOUBLE QUOTES. USE A DOUBLE QUOTE IN XCODE EVERYWHERE IN THESE NOTES THAT YOU SEE A SINGLE QUOTE. The is where the code adds the 'you are here' text to the call-out bubble. This is the text we want to change to show the users current lat / lon. Change it to... self.mapView.userLocation.title = [NSString stringWithFormat:@'You are here. Latitude: %f, Longitude: %f', self.mapView.userLocation.coordinate.latitude, self.mapView.userLocation.coordinate.longitude]; That line of code needs to be all on the same line, the forum may wrap it to several lines? Single quotes are double quotes. c) Compile, test. Should be fine. In the simulator the location will always show Cupertina CA (Apple HQ). Test on a device for best results. lemme know when you get throug this and we'll do Android next. Same idea.
 
WolfTimJ
buzztouch Evangelist
Profile
Posts: 810
Reg: Feb 20, 2011
Rockwall, TX
17,400
like
03/25/11 06:20 AM (14 years ago)
ok, did it. So the map that comes up on the simulator with a call out which says, Your iPhone Simulator S De Anza Blvd, Cupertino On a device it will have the Lat Long in that callout? If yes, that is perfect. Will buzztouch allow me to make a single map location screen without a location so it simply zooms down to the phone'c location? Tim
 
WolfTimJ
buzztouch Evangelist
Profile
Posts: 810
Reg: Feb 20, 2011
Rockwall, TX
17,400
like
03/25/11 06:58 AM (14 years ago)
Running on a device the only text above current location is now Current Location No lat and long or anything else. This is on a single map location screen.
 
WolfTimJ
buzztouch Evangelist
Profile
Posts: 810
Reg: Feb 20, 2011
Rockwall, TX
17,400
like
03/25/11 07:37 AM (14 years ago)
Weird. Ran it again. I have many single location maps. All of a sudden one I pulled up had the call-out with the lat and long, no others. Then after switching to a different one, the one that previously had it was back to Current Location. Deleted the app, ran it again from xcode now it's back to Your iPhone and the address in the call-out, then another single location screen is back to Current Location. The map screen akways has the loading icon turning. The blue dot has a pulse so I think it has GPS signal. Just to confirm: I cut and pasted the line of code, and replaced both ' with . Ok, sorry this is rambling. After messing with it a while. The map shows the blue dot correctly, somewhat randomly shows the Current Location or Your Iphone. I can get the lat long callout to show momentarily by swiping the map so my location is not visible then hitting the Show Me button. It shows the lat long for an instant then reverts to one of the other two. Tim
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
03/25/11 09:14 AM (14 years ago)
This is strange. So, the sim should always show the Cupertino location so no biggie there. Your phone should not. The self.mapView.userLocation.coordinate.longitude value is a number - so is latitude. I'm baffled as to why you would see the 'name' of the location in your phone? Kindly email the LocationMap.m file to info 'at' buzztouch.com and I'll get a look.
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.