I've heard of geofencing and I have some doubts. Hope you can answer some of them.
-It's new for iOS 5.1 but what is the difference between geofencing and Using Regions? From what I've read is nearly the same, the battery drain?
-Why can't I find apple documentation on geofencing?
-How do you define the regions? can I add them remotely, via webservice?
Thanks.
App Developers can use native Android and iOS location detection to power their location-based experiences and engagement. However, native geofencing technology can only deliver accuracy of around 100-200 meters. For context, that's about the length of a soccer field.
Myth #2: Geofencing Drains The Mobile Phone Battery Some geofencing providers use GPS for geofencing, which does have the effect of draining smartphone batteries faster. At Plot Projects, because we use cellular and Wi-Fi technology, this is not the case.
Geofencing is a technology that uses location information from a smart device—like GPS, RFID, or Wi-Fi—to track whether a device is inside or outside a “fence,” a virtual boundary around an area in the real world. The technology is used for a variety of purposes, like security, location tracking, and advertising.
Even with your location tracking turned off, a geofence can still establish your general location through your device's unique IP address.
Geofencing has actually been around since iOS 4. You can find documentation on it in the Apple Location Awareness Programming Guide. It is also referred to as "region monitoring".
The regions are pretty simple to use. Create a CLRegion
with the center point (lat, long), radius, and a unique identifier. Then call the -startMonitoringForRegion
. Granted you will need to register a CLLocationManagerDelegate
to listen for the callbacks, -didEnterRegion
and -didExitRegion
, but that is pretty easy to do as well.
You can't add them remotely. Only from the device. I have learned a few things about them over the last couple years. So hopefully this will save you some trouble down the road.
Geofences are a great way to add functionality to locations without any of the overhead active GPS and location tracking has. In my experience, geofences pose no noticeable battery drain when leaving on all the time. Apple has them figured out pretty well. They don't carry the same accuracy as active GPS, but they are close enough. Good luck.
UPDATE Some of the information here is a bit dated now. The number of regions you can monitor is now 20 and is capped per app. Also, the minimum size is not 100M, it can be smaller, but accuracy is not guaranteed at lower numbers.
"Geofencing" has always been around, since iOS 4 in the form of "Region monitoring". It uses distance checking to see if you've entered a circle. This is not true geofencing, as true geofencing is checking if a point lands in a polygon (called point in polygon).
As of iOS 6, there is currently nothing akin to region monitoring that uses point in polygon. To do true geofencing, you would have to use a combination of Region monitoring and GPS. There is no Apple documentation for geofencing because CoreLocation doesn't support it.
If you are going to take the point-in-poly approach, I would recommend ray casting. There is an Objective-C class that implements it really well. It's called objc-BorderPatrol.
As for sending fences from a web service, it may be possible to do something similar to Twitter's streaming API, but that may be too intensive. It's better to use Significant Location to update your fences. If you're going to send fences from a web service, I would recommend using MySQL or PostGRE SQL as both have really good geospatial extensions.
A few caveats:
-> -[CLRegion containsCoordinate:]
is never called by any CoreLocation object. All of the distance checking is internal.
-> Significant Location updates every 500m or 5 minutes, whichever comes first. Significant location uses the IP address from a cell tower to determine location.
-> Geofences and regions can overlap, keep track of this.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With