Can latitude and longitude be added to a record in an iOS address book?
My app wants to display nearby contacts on a map. I know how to get the latitude/longitude from an address. I do not know how to save them so I can avoid repeated lookups
Yes, you can add a latitude-and-longitude address to a contact in your iOS address book. It takes one extra step to view the map pin from that address, but it works.
Open an existing or new Contact, and create a new address. Under Street, put in the latitude and longitude, with a comma between but no blank space.
Leave everything else empty: city, state, and so on. It will force you to pick a country, so either just leave the default, or if you want, you can select the country that corresponds to the coordinates, though it really doesn't matter.
For example, you could enter:
• Street: 48.8582,2.2945
• Country: France (or any country)
(For locations South of the equator or East of the Greenwich meridian, add a minus sign: e.g., -17.53655,-149.56832).
Save the address.
To go to the location in Apple maps, open the Contact and click the latitude/longitude address. This will take you to Apple maps. Don't wait for the map to come up, because if you wait the pin will be dead center in whatever country is listed. Instead, while it's thinking, just go to the address bar at the top and edit out the country so that only the lat/long is left and hit Search. This time, the pin will go directly to the correct latitude/longitude location. If you want Google maps, just copy/paste the lat/long into Google maps.
The example shown above should put you right at the Eiffel Tower. Bon voyage!
In iPhone native address book it's not possible to store. But you can do one thing, you can store info of the user in SQLite database in your app along with lat lon and if you want some synchronization functionality then you can create web-service which will update your SQLite database as per your logic.
Hope this will help you.
All the best !!!
I am not sure but this may be not possible to add latitude and longitude value to ABPeoplePickerNavigationController. but if you want to find distance between two Contact then you can find it from contacts's address or add your latitude and longitude value into database and use 2 option of mine .
There are two way for find location by address
1) How to get street address from ABPeoplePickerNavigationController
2) use reverseGeocodeLocation and also check this my answer CLLocationManager not getting City name this is helpful for you.
Related
I want to build a flutter app in which I want to trigger a notification when a user enters a place of a specific type.
places of specific type means (saloon, restaurants, hospital, etc) these all are types of places.
Requirments
I want the system to work offline. (like if the user dosn't have
mobile data & user enters the specified type of place he should
recive a notification).
I want the system to work in background.
(when the app is terminated(killed) & user enters the specified type
of place he should recive a notification).
My approach
when the user installs the app and opens it for the first time, the
app will cal google places API and save latitude, longitude of all
places of specified type near him.
and then use the background_locator link plugin to monitor users
current latitude, longitude.
on every change of latitude, longitude find distance between users
latitude, longitude, and all places latitude, longitude that we
stored.
if the distance is below 50 meters between users current latitude,
longitude, and certain place latitude, longitude then trigger a
notification.
problems with my approach
Background service will be running all the time in background(also
when the app is killed) witch will consume battery alot.
As the background service will be running all the time the whole
distance calculation will happen every 5 to 10 secs or you can say
every the background service fetch users current location which is
also not a good thing.
If the user goes to any other city How will I update latitudes,
longiudes of the nearby places ?
As we know some places have areas(size) and some have small, and
distance of 50 meters will not be accurate for all places.
What I want from you
If you have a better approach for solving the above problem, share it
with me.
if you can improve the solution that is also appreciated.
do provide me names and links of plugins in your approach.
I want get exact user sitting position latitude and longitude values in a room or building. I am getting user location latitude and longitude values through CLLocationManager but not exactly showing. Is any possibility through get user exact building latitude and longitude values.
Thanks
Laxman
GPS precision is usually at best 10m, so you cannot expect to obtain positions with better precision than that, which is not usually enough for positioning within a building. Besides, if your user is not using GPS, you will get network-based positioning data which has yet lower precision.
I don't think you can use CLLocationManager or any other out-of-the-box positioning service for that.
Technologies exist that can be used to locate a phone within a building based on other sensor data (eg. https://en.situm.es/solutions.php), that perhaps you could apply.
There are also ways to improve GPS precision outdoors (eg. https://es.wikipedia.org/wiki/Wide_Area_Augmentation_System) depending on where you live. It all depends on your application.
I am a newbee to Iphone App Development and struggling with my first application.
I have a database with few address in it. All I have to do is get the current location and pick the closest three address from the database and of-course have to show the current location and the selected three nearest address on a map with directions on them.
I had a look at the Xcode frameworks LocateMe, CurrentAddress and MKReverseGeocoder Class Reference.
But then not sure how to co-ordinate this all together in an orderly manner.
Any suggestions/assistance would be greatly appreciated.
Thanks
You should provide lat/lon with your addresses in your database, so do the geocoding of the addresses before.
You have a location manager (CLLocationManager) which takes care of your current position, and with each location (CLLocation) you can calculate the distance (distanceFormLocation:). Now you only need to sort your database with this and pick the first three items.
Hmm?
I want to get nearby cities from current location depending upon distance, e.g, cities in radius of 100km,200km etc using the gps of iphone. How can i determine these cties as gps only gives the details of the current location.
Thanks in advance
You need to have a database of the cities in your program, with their coordinates.
You'll read the coordinates of the iphone from the GPS, and then find the x closest cities to you by simple math (see this answer for an example)
You will have to have a custom list of cities and their respective locations and work it out yourself, or potentially use something like google local api, but I don't know if you could reliably return cities through it.
Generally speaking, how does an app like "Around Me" acquire the information it displays?
For example: the restaurants that show up in a list that are near me with the address and distance (I think I get the distance piece) where is this information extracted from? Is it Google or something?
I'm not asking how to implement this (that's over my head!) just get an idea of how it occurs.
Thanks StackOverFlow people.
I haven't seen that specific app, but most such apps either have an embedded database of locations or they dynamically query a server back-end (e.g. using HTTP) to fetch a set of locations near you. They know where you are because the app has access to location services to find out your geographic location.
The iPhone has a GPS unit which gives you your latitude and longitude, which it then sends to a backend server (Say Google Maps) and queries it for, in your case a restaurant. The server responds with a set of locations around you.