I would like to check in which country the user is - I have tried a few ways but none give the requested result. My main goal is when the app launches check in which country the user is and based on this by pressing a button call a different phone number, For instance user can be in Canada use the app and by pressing the button dial an XXX number and next week with same Iphone be in the US and by pressing the same button dial a YYY number.
I have tried using CoreTelephony but this is good only for 4.0 and up i want my app to support earlier versions of iOS also tried Geocode but i do not want to display a map in my app.
Any guidance will be appreciated.
Get your current location and reverse geocode it.
Get your current location using CLLocationManager. Reverse geocoding is supported by iOS SDK 5, so if you need support versions below 5.0, you need to use external geocoding service. For example, Goolge Maps Reverse Geocoding, that is described in details here: http://code.google.com/apis/maps/documentation/geocoding/#ReverseGeocoding
What you need to do, just send a request like below:
http://maps.googleapis.com/maps/api/geocode/json?latlng=40.714224,-73.961452&sensor=true and you'll get back a JSON with formatted address components.
Related
Is it possible to share user's location to other user (of the same app)? I want to build a geolocation sharing app that pings/notifies user A once user B has crossed a certain radius. Doable with firebase or a similar third party? thank you in advance
Let me see if I understand, what you want to do is:
1 - If user A passes near user B (on the street), notify both users that they are nearby?
2 - Do you want to share the user's location through an application and send it to another user, either through a social network or email?
If it is option 1, you will have to obtain the latitude, longitude and accuracy of the users and keep sending and obtaining it from Firebase every so often (or through a socket connection like socket.io) and make a match and calculate the radius or distance between both points.
I am looking for a way to get or make turn by turn navigation using Google Maps Api in swift. I've done drawing polylines from source to destination using GoogleMaps Api but still couldn't find a way to do turn by turn navigation. Is it possible?
-Thanks
Yes. It is possible.
Please refer following link which is using turn by turn directions using google API.
https://itunes.apple.com/us/app/biznavi-gets-you-where-you/id597147565?mt=8
(see last two screen shot of iPad from itunes link)
To achieve it, you have to use Google Direction API which allows us to use upto 8 way points.
After that you will get an array of route including all turn by turn message and lat/long.
Just create a CLRegion of 100 meters (or as per your requirement.) around your current location in locationDidUpdate method. If next point of route array falls within CLRegion, just show a message received in routes array by google API.
I have made above application but it was not updated after uploading to store so it is having old UI and it is not having iPhone 5+ support. Sorry for that but you will find feature you require in this app...
I want to send an auto reply to the user's tweets from his iOS application, I am able to do that if the user has allowed the iOS application to access his location, but when the access to location is denied by the user, tweeter is not allowing sending the auto reply to tweets.
I'm wondering whether it is mandatory to have access to the user's location to send an auto reply to his tweets. Or, do we have some reliable way to accomplish the specified functionality without accessing user's location?
OP, from what I understood, you want to find out a given user's location without consented access to the user's phone's location services.
A way to do this, not super reliable I'd add, is to reverse geolocate their IP Address using a server side geocode API.
Mind you, it is not super reliable but might do the trick. You might encounter problems on mobiles, especially due to the erratic nature of their IP Addresses.
Twitter themselves have an API to help on that. For example you could use GET geo/search to find out a place ID closest to a given IP Address using this:
https://dev.twitter.com/rest/reference/get/geo/search
and then you could use that place ID to find out the approximate Lat / Long of the user, using GET geo/id/:place_id:
https://dev.twitter.com/rest/reference/get/geo/id/%3Aplace_id
(there are probably straighter ways of doing this in other APIs aswell but I'm assuming you are already authenticated on twitter's API so I'm trying to give you something easier to integrate into your code)
Let me know if that helps.
I haven't implemented it yet but can guess that Twitter does so to avoid the spam or robotics tweets. So if Twitter gets multiple auto Tweets from same place so he would consider them as spam.
What you can do is after every 8-10 Tweets make new latitude longitude and send this location to Twitter while using auto tweeting.
How ?
Take a default location (lat, long) and you can find add 500m-1km in that location every 8-10 Tweets and use this new location for next time. This method is not reliable but can work in your case.
Note: Use this way only in case when you're not able to get device location.
(apologies if it seems like a rookie question but I work for a startup & given the stage where we are, I can use all the help to move things fwd .. thx guys!)
I am building a map based iOS app wherein its good to have user's location but not mandatory.
If the user selects "Don't Allow" for sharing his location, then I want to either have the map take him to a hardcoded lat/long pair OR I can show him dropdowns to pick his location but then it just does not drop the marker.
There has to be someway in which iOS app developers want to use maps but dont mandated detcting user's location .. How does one do that (if at all that's posible)?
Have a look at CLLocationManager class.. you can always check the Authorization status of the user loacation choice using + (CLAuthorizationStatus)authorizationStatus of CLLocationManager class.. Based on that you can decide your other actions like sending a hardcoded location value to someone or not.
POI: Point of interest(http://en.wikipedia.org/wiki/Point_of_interest)
Is there a iOS api which I can use to get a list of POIs near a user location? Here's what I want - the user enters a search term and I already know his latitude and longitude. I want to get an list with the POI details based on the search terms.
So lets say I search for Starbucks at a particular location, I should get all Starbucks within a radius of say 5 miles from where I am.
Can iOS API do this?
Not natively within iOS, but you can use a third party provider, such as YellowPages.com.
http://www.yellowapi.com