How to locate any mobile number using iPhone application - iphone

I want to make an application on iPhone which locates the mobile number region(area) when the user gets a call. Can anybody give me guideline how to accomplish that task?

You can't access the details of an incoming call on the iPhone.
Crazy idea: User would define a phone number of your server (SIP, VOIP) as "forward when declined"-number. When the user gets a call, he would simply decline it, so it would be forwarded to your server. There you could extract the information and send it to the iPhone (Push Service). And finally you would redirect the call back from the server to the user's iPhone.

For anyone looking for an answer to the second part of this question (how to get the location for a number), there is a similar question (asked interestingly enough one day before this one) with several answers here:
Telephone area code to city name on iOS
I also discovered an SQLite database named calldata.db in the private framework AppSupport.framework that contains US cities, states and area codes, as well as prefixes (the three digits that come after the area code).
Using a query like this you could find out that area code 212 is New York, NY:
SELECT * FROM citycode, npanxx, npa
WHERE npanxx.npa = 212
AND citycode.code = npanxx.rate_center
AND npanxx.npa = npa.npa
I don't however know if accessing/packaging this database would violate any agreements with Apple (I do know that the Default.phoneformat file from AppSupport.framework has been packed with several apps which had no problems getting into the App Store, see comments here: https://stackoverflow.com/a/13116227/381233). Perhaps there are some methods in the AppSupport.framework that would get this information more easily, but that would definitely not be allowed in the app store.
As for the other part of this question (access the details of an incoming call), this would most likely be possible on a jailbroken phone. No doubt there's already a tweak in Cydia that does this.

Related

Password login for ios app

I am currently developing an app for a company that is in a very competitive field. I have finished all of the features of the app that they requested except for one, making it somehow protected from their competing companies to download and use. I thought that I could set up a UIViewController with a password field that would check against some kind of database, but I'm not sure how to do the checking against a database part nor the practicality of it, and was hoping I could get some ideas on how to do this so that other companies couldn't steal and use this app without a password or something that changes like every 30 days or something and is kind of like an activation code.
Review the WWDC 2012 video "Building and Distributing Custom B2B Apps for iOS". I'm unsure if your app is in this B2B classification, it seems that it might be from your description.
What I ended up doing (if everyone needs a reference) was setting up a server with an SQL table that has pass codes in it. Since apple does not allow for any sort of system that requires you to "buy the app from outside the app store" I made a dumby username field (shame on me) that takes any value you like and then requires to have a pass code that fits. Once the pass code gets authenticated with the web server in a json sql request (there are plenty of api's to do this with) it comes back and sends the user to the first screen and sets a value in a plist with how many days of use the user has left. Whenever the user opens up the app it checks to see if the date is different from the last date logged in (saved in the same plist file) and if it is different then it calculates the difference and deducts that many. When the count reaches 0 it sends the user to the pass code authentication screen again. A bit complicated but an effective method of getting around Apple's restriction on not having a sort of pass code system like this. Thanks for the answers, unfortunately enterprise did not work for this company since they needed to be able to distribute the app to as many 3rd party members as they wanted to without having to worry about them leaving the company for other suppliers and remote management of the app (I.e ability to remote uninstall) was also not an option. Hope this helps someone someday!

Reading iPhones call, SMS and data usage

my team is currently in the feasibility phase of a 'usage meter app' iPhone app. We would like to read the phone's total count of
Sent SMS
Made calls
Data sent and received
We are not after the call history like other posts or like this blog post reading the actual call logs (http://iosstuff.wordpress.com/2011/08/19/accessing-iphone-call-history/). All we need is the stats and how they change over the course of time.
As of iOS 4.0, it's no longer possible to do that call history trick described in the blog entry you posted there. Apple took away that "artefact of the implementation".
If you are a registered developer and have access to Apple's "private" dev forums (at https://devforums.apple.com), do a search on "call history" over the past year or two and you'll see Apple engineering attesting to that fact in the first few threads you'll find.
You'll probably want to file an enhancement request at http://bugreporter.apple.com, but I wouldn't expect a positive outcome immediately as this probably raises security and privacy issues.
As for network statistics, you can get per-interface stats via "getifaddrs" (man page linked for you). You get the list of addresses on that system, and then for each AF_LINK address, cast the ifa_data field to a (const struct if_data *) and access the interface statistics from there.
(there are also two caveats -- these stats are all reset to zero at startup time, and there's no easy way to easily tell which interface is cellular versus WiFi).

Getting current location and posting it to a web service

Ok... maybe forbidden by Apple, but assuming this is permitted. What would be the best way to get the current location (not difficult) and posting it to a web service (also not much of a challenge). The app is for an artist who wants people to see where he is at the moment. Personally, I wouldn't want people to know where I am 24/7 but that's performance art I guess. An exact location is not wanted but a town or area would be preferred. I could modify the string when it gets to the server and make it more vague by rounding the LOG and LAT.
The app the fans would use would retrieve his current location from the server and update the map view with a location.
I suppose one way would be for him to find out his coordinates and post that to a web page but I'd like it to update automatically.
A response with code is not necessary, just a general opinion on methodology/advisability would be appreciated
I would probably give him a webpage to go to that records his position every time he visits. It would be a private URL, and perhaps use some lightweight authentication. For versatility, I'd record the exact position in the database (in case he changes his mind on how it should work later on). However, you could use an external service or another purchased database with zips or city information with lat/lng data, so you could just provide users of the client app with his general vicinity rather than exact location.
The alternative would be to give him an ad hoc app that does the same thing, but putting together that location recording webpage would be a much simpler process. Could be handy for other things, too.
Here's a little writeup about getting location from mobile Safari, just as a reference: http://mobiforge.com/developing/story/location-iphone-web-apps
Why wouldn't you just use google latitude and read out his status?
I think this should really be done as a web page web-app. You can get coordinates from the device through mobile safari and you can skip the app approval process. You can also set it up so it runs fullscreen on his phone and he won't know the difference. You can also put a password on it.
There is a good chance it would not get approved as a regular app.
You can always meta refresh the page to keep it updating.
http://smithsrus.com/gps-geolocation-in-safari-on-iphone-os-3-0/
"Artist" must log in to his application (thus insuring that he want to share his coordinates with your webserver), then you use CLLocationManager to get his coordinates and make a reverse geocoding using Google Maps API to get country and city for given coordinates.
Can't see anything special about it :)

get data from online once and then viewable offline

Okay, I want to have an app that takes phone numbers from an online database and displays them in a table view. When the user is not online, I want them to still be able to see the numbers they already got from the database in the table view. If the user manages to go back online, the database updates the view. My question is, is this possible to do and if so, what's the best way to approach it? (bit of a newbie, please help me out)
There are many ways to do what you are asking, depending on the complexity of what you are after.
Could I suggest the following steps (I'm not sure which ones you can do, and which ones you are having trouble with).
Connect to the server and retrieve the list of phone numbers
If the database has a web server front end this might be as simple as sending a get request to the server (see NSURLConnection) and parsing the result. Otherwise you will need to know/tell us what type database you are using.
Store the phone numbers on the device
Use SQLite to store the numbers on the device (See iPhone SQLite Resources)
Check for internet connectivity
Periodically check for internet connectivity, and if a specific time has elapsed since you last polled the server, retry. (See Checking iPhone internet connectivity)
Although you’re probably looking for a native app solution, you can also do this with a web app.
http://diveintohtml5.ep.io/offline.html
I am a new developer iPhone developer, "learning" to be precise. I came across the useful NSUserDefaults (a dictionary in which you can store/restore state even after your application relaunches). Problem with this dictionary will be memory in your case. NSUserDefaults is sort of global to all applications and yours may spoil the show for other innocent applications (like Weather :D ).
To work around this, you can have your application declare a property list file where you store a few numbers (best practise would be the most recent but you can use any selector of choice). Look for an appropriate time in your run loop to store these numbers into your property file and load them when the application starts.

Manage country wise databases on different servers in iPhone App

I have current a developed app which I am going to submit in just few days .
Currently The Application shows data by calling a web service and fetches data from a server .
Now client requirement is to build two different databases.
So the question is should I make two different builds for two different countries or should I make alternative call to the web services based on the format region selected in the iPhone .
e.g, if ( country == uk ) then
call uk_Service;
else if( country == us ) then
call us_Service;
Please tell me which approach is better. And also if should I make two different builds then can I submit both of them at a time in the AppStore .
Thanks
I don't think it is a good idea to have two different builds for the App Store. This would mean that you have to do all the organisatorial overhead in iTunes Connect twice. For example an update with all the screen shots and textual descriptions have to be submitted twice. Also you do not have a chance to ensure the release of both submissions will be synchronous.
Why don't you provide a setting to the user where he can choose the country he wants to use your app for?
I would go with the if/else option purely because maintaining 2 apps instead of one will be more work - eg when you want to fix a bug you'll have to do it twice over. Another advantage of using the localised version is that a user can change their localisation and start using the correct database - eg they buy the app in the US and then move to the UK, change their settings and can start using the UK database without a problem