views:

336

answers:

2

I know there are a few apps out there to fake a devices location but specifically what i want to do is use a location grabbed from a url.

What direction should I look for setting the location on the device.

The scenario i have is a jailbroken Wi-Fi iPad tethered to a nexus one. The nexus one would host a background service that when a request is recieved, it would respond with gps data of its current location. The jailbroken ipad would have a background service that either updated the location on a time interval, or on a per request basis (depending on how i have to implement it) by submitting a request to the tethered nexus one service. That data would then be set on the ipad and an application requesting location would get the service data.

The goal is to recreate the location faker app's functionality with the exception of the spoofed location comes from the nexus ones gps via the service but i have not yet found out how to set the location data for the device. I can ofcourse implement this in a per app basis but it would be awesome to have any app be able to use it.

+1  A: 

Well, the way to get the location on iPhone is via a CLLocationManager. If you want to get a custom location, then just subclass it and override the startUpdatingLocation method to not call super, and then just invoke the delegate method yourself. Something like:

@interface CustomLocationManager : CLLocationManager {

}
@end

@implementation CustomLocationManager

- (void) startUpdatingLocation {
  [[self delegate] locationManager:self didUpdateToLocation:customLocation fromLocation:nil];
}

@end

Then you can do:

CLLocationManager * manager = [[CustomLocationManager alloc] init];
[manager setDelegate:self];
[manager startUpdatingToLocation];
Dave DeLong
but this would only work for other locationManagers in that current app correct? I am looking to have a background service running that sets the location for all apps that request it.
AtomRiot
@AtomRiot there's no way to do that on a non-jailbroken device
Dave DeLong
yes, i know. This is a one off solution for my scenario and in my scenario it IS a jailbroken device. that fact is mentioned in the initial question
AtomRiot
@AtomRiot ah sorry, I missed that.
Dave DeLong
voting up because it answered my question even though it wasn't the OPs question :-)
sbwoodside
A: 

Core Location presents significant privacy and personal security concerns. For that reason, it will be very difficult to crack or spoof even for a jailbroken device. To my knowledge, the location is calculated every time a request for location is made (which is why it drains the battery.) There is no file or setting that can be easily set.

In order to spoof the location for all apps, you will have to patch the system code that Core Location calls. There is zero documentation for that system code as it is all Apple proprietary. You have to find someone who has reverse engineered the Apple Code for some reason.

Your best bet would see if there is a custom process running that manages locations and then replace that entire process with one of your own that returns nothing but the spoofed location.

No matter what, your basically going to have to recreate the entire interface that Core Location calls to ensure that every Core Location call in every app works. You're looking at a great deal of low level C coding in an API with no docs. The odds of getting it right are fairly low.

TechZen