iPhone alert an alarm if stolen - iphone

We are developing an enterprise application .The phones are connected to a Wifi router. The objective is to trigger an alarm if the phone moves out of the secure area .. (outside the building)
What is the best way to check if the iPhone is always inside the building .
some of the options we tried are
1.using Wifi(continous ping to wifi network),if not trigger an alarm .
2.if coordinates change (using GPS)
Are there any other means to achieve this .

You can use Location Services in iOS 4 (with the background location feature) to determine when the phone has moved to a different location.

#indragie's idea of using Location Services is a good one. If you can be sure that the WIFI SID isn't going to change, you could probe to see which access point the iPhone is currently associated to. If you are going to ping, then a better approach is to make the system service agnostic, and simply issue an HTTP query on a regular basis to your enterprise server. The server can then have a policy language on it declaring acceptable access points (from a variety of metrics). This might be set up to allow people to take their iPhones home.

Your best bet is GPS as the phone will not be able to find its location if you rely on WiFi and the device is not connected to a WiFi network.
Check out Apple's documentation for Location Awareness capabilities here http://developer.apple.com/library/ios/#documentation/UserExperience/Conceptual/LocationAwarenessPG/CoreLocation/CoreLocation.html
You will be able to track "significant" or standard location changes in the background, details can be found here http://developer.apple.com/library/ios/#documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/BackgroundExecution/BackgroundExecution.html#//apple_ref/doc/uid/TP40007072-CH5
[edit to include]
This might be of interest to you too - http://longweekendmobile.com/2010/07/22/iphone-background-gps-accurate-to-500-meters-not-enough-for-foot-traffic/

It depends on what you want to do. Just to let the iPhone user know that he/she is moving away, using Location Services is good enough.
However, if you want to have a server that makes sure all the devices are within range, then it's more complex because your application may get suspended without a notice from a background state; in other words, you may not be able to catch the moment when your application terminates and take appropriate actions. Therefore you are going to need a heartbeat system like pinging to the server in this case.

Related

Can we make our own Find My iPhone app

I am thinking to make my own app like Find My iPhone app . But I am confused that whether apple allow developers to have access to play with the security or is there such Apple API's that can help us to include features as in the above app. Any suggestions?
Well I just can't comment because of low reputation. But people must give a reason to down-grade a question. Its quite a valid question.
Creating an app like this is semi possible. Due to the fact that you are not allowed to keep running in the background, except for certain special cases. Such as Music or a guidance app (navigation apps)
Your app can register to receive updates from the GPS location and process them.
The problem is it will use your gps all the time.
The find my iphone app is a combination of wifi location/sim card location/gps location.
It uses a combination of all these items which it has to keep track of your location as close as possible. Now back to your question, the fact that you cannot keep running in the background, will mean the app needs to stay open all the time (open I mean running, not necessarily onscreen). Not like the application from apple itself, which of course is allowed to go outside these developer restrictions.
The APIs exist for you to create the main functionality of this app. Core Location and APNS
When use A is looking for the location of user B, A would tell a server that it needs user B's location.
A push notification could fire up user B's app, at which point...
User B's location services would kick in, in the background,
Send this information to your server
Then update user A with another push notification.

Find iPhone devices/device tokens in specific radius :-

I want to find iPhone devices/device tokens within a specific radius from particular location.
For example : Within a 25 K.M. of radius from Sydney,i want to get iPhone devices tokens.
I am working on ASP.NET MVC2 for this.
Let me know,if is there any API for that?
Thanks,
You are only able to get details for devices that you 'know' about. Your app will need to log unique IDs for each device, and your app will need to log known locations for devices. It's then up to you to look up, from your central database, the details of the devices within a certain distance. iPhones can update significant location changes when running in the background but it's up to you to track devices and accept the limitations that that data may not always be correct. eg. If a user falls outside connectivity then you will still have an old location logged for that user.
I'm not aware of a single API that offers this services, if you're coding it then in your app you will need to register devices identifiers and location information to a central server. You will also need to create the lookup to query your data to find devices within a location. I am guessing that you might want to send push notifications, in which case your app will also need to register for notification services too.
There is no way for you to discover devices that don't have your app running and you also do not know who the owner is.

Is it possible to create a background service for Windows Phone 7.5 or iOS?

I have Android application where service running 24/7 Phone get's GPS position every 5 minutes and sends to server. This is requirement.
Can I write same service for iPhone? I'm not sure if it's possible.
Can I write same service for WP7? I think it wasn't possible to run service before. Did anything change in 7.5?
EDIT:
I'm not sure why somebody downvoted. This is concrete Yes/No question.
It is possible in WP7 with the introduction of background tasks in Mango. In fact, there is a built in mechanism for polling the GPS provided by the API that is more battery efficient.
Not sure if it goes down to 5 minutes, think it is something larger like 30 minutes. It is also not comparable to a Windows Service - so don't go fowards with that mind set. Background tasks are heavily constrained to keep the phone responsive for the user - to make use of them, you need to play nice with the requirements.
Background tasks introduction, it also talks about the GPS thing I mentioned. The entire series is well worth your bandwidth and time downloading and watching:
http://channel9.msdn.com/Series/Mango-Jump-Start/Mango-Jump-Start-06-Windows-Phone-Multi-tasking--Background-Tasks
Can't answer for iPhone.
It is also possible on ios4+ but it wont be time-triggered. Either you register for precise (gps) or vague location (wifi and wan location) which is available to get in background but it is not always possible to send that data to a server because after 10 minutes in background your app is not allowed to keep a network-connection alive. So you have to buffer that data and have to wait until the user launches your app.
The ios pushes notifications to your app depending on the needed accuracy and depending on a distance-filter
ios-apps do not differ between services and activities (like in android). it is all combined in one app.
There are "some limitations"(a lot) here too, but maybe Microsoft Push services works for you:
Push Notifications Overview for Windows Phone
Because polling is not a good practice for this, push works better in this cases.
In WP7 Mango you can't get a fresh location from a background agent. The following code will return the latest available location (up to 15 minutes old):
private GeoPosition<GeoCoordinate> GetCachedLocation()
{
GeoCoordinateWatcher geoWatcher;
geoWatcher = new GeoCoordinateWatcher(); //Start a new watcher with default level of accuracy
geoWatcher.Start();
//Get latest cached position
GeoPosition<GeoCoordinate> position = geoWatcher.Position;
geoWatcher.Stop();
return position;
}
As you can see, this uses GeoCoordinateWatcher. According to MSDN (http://msdn.microsoft.com/en-us/library/hh202962(v=vs.92).aspx):
This API, used for obtaining the geographic coordinates of the device,
is supported for use in background agents, but it uses a cached
location value instead of real-time data. The cached location value is
updated by the device every 15 minutes.
Other than that, I haven't been able to find much information. You could create a GeoCoordinateWatcher with a self-defined accuracy, but I haven't tested this. Perhaps it would return the latest available cached location that satisfies the accuracy requirement.

Detect other iPhones/iPads in the vicinity

I am thinking about a web app to detect the presence of the other iPads/iPhones. This is purely theoretical at the moment, i have no idea how to do this.
My question is what is my best technology/language method of doing this?
Is it going to be bluetooth or gps? How does the App Bump work?
Thanks for any suggestions posted...
Bump's FAQs: http://bu.mp/faq
According to their FAQs, when your phone has the Bump app up and ready, the app listens to the accelerometer for a sharp stop (your hand with your phone in it stopping when it hits the other person's hand with their phone in it), at this point, exact date time information as well as GPS position and characteristics of the bump are sent off to Bump's servers to compare other information from other bump users to see what other bump account shares most of that information. Bluetooth is not used in any capacity to make this happen, not for the transfer or the recognition of who to transfer to.
Your website may have to do the same thing. Have every instance report to your server, and then report back from the server where other people are.
Of course this goes without saying that I'm sure you were thinking about privacy settings and other layers of personal security.
Options I'd explore:
Bonjour discovery. In principle devices that can see each other via Bonjour could actually be in different continents, but usually it means 'same wireless network' and therefore at least 'same building'.
Game kit. Actually, this either uses Bluetooth or the local network, so is probably going to have similar results to Bonjour discovery but in less code.
I wouldn't try location services like Core Location (actually I would, but only if the above don't work), as the results probably aren't going to be fine enough. Especially indoors: the Maps app on my phone places me in a circle of about 50 metres radius with my actual location being on the outer edge of said circle. Someone on the next street with similar resolution could, as far as the app is concerned, be adjacent to me.

Recognising nearby iPhones running my app

I have a requirement in my iPhone app that I know when somebody running the same app is close by.
I'm thinking that GameKit using Bluetooth would let me do that. GPS location is not precise enough in this particular case.
However, if the user closes the app then the function won't work anymore. Even under iOS4, the task switching will close down the BonJour services so I can't have the app run in the background.
Seems to me I can only have this function if the user leaves the app up and running. Would you agree? Or is there a different approach I can take?
People are very concerned with privacy, so they would naturally expect such privacy invading functionality to be switched off when they close down the application.
If they choose to have this feature enabled, then it's a different matter. Then they expect that somebody else may locate them.
You might however consider implementing some sort of opt-in offline service, where the latest gps position is stored on a server including a timestamp. When somebody else (with the app running) moves within a certain distance of this location while it's still "fresh", then you send off a notification to the first device. That way the user would be notified that somebody may be close, and can then switch on their own device.