PDA

View Full Version : Something a little more ambitious


evan
2010-07-20, 17:57
Just so you know upfront, I'm not looking for specifics here, just big picture stuff to point me in the right direction. I'm trying to conceptualize a pretty big project and would like to get a sense for what technologies I would need, what skills I would need to have, and maybe some sort of game plan for tying everything together. So here's the question: How do I get multiple iPhones to automatically communicate through the internet to see if they are near each other, and if they are send push notifications to each one? What would I need to know to get this done?

turtle
2010-07-20, 21:10
You could see about getting access to Google's cell tower references and use that with the location data from iOS.

Seems the trick would be getting the phones to talk to each other...all the time. Maybe have it update it's location on a central DB that could send updates to the others via push.

Just ideas off the top of my head. Search XDA Forums for TrackMe. It has this feature for WM6 phones.

evan
2010-07-20, 23:31
Seems the trick would be getting the phones to talk to each other...all the time. Maybe have it update it's location on a central DB that could send updates to the others via push.


that's more or less what I was thinking... but how would I get something like that off the ground? I've never done anything like that from scratch so I'm sorta clueless in that regard. I mean I've used databases for class projects but that was all set up for us by the professor and we basically just had to punch in some SQL code. And if/when I do set that up, how do I integrate it with the iPhone app?

turtle
2010-07-21, 10:30
That is all over my head. I'm a hardware tech, not much into coding.

chucker
2010-07-21, 10:49
How do you define "near"? If it's within Bluetooth range (say, within the same room), they can discover each other that way. You appear to mean a wider range, though. In that case, you want to use Core Location to have all cellphones transmit location data to a central server of yours. That server then needs to do the actual coordinate comparisons to determine proximity, and contact APNS (Apple's push notification service), which in turn will send push notifications back to the devices that happen to be near each other.

So you need an app running on each iPhone, using iOS 3's push notifications (to receive) and iOS 4's background location API (to transmit), as well as a server (e.g. PHP-, ASP.NET-, etc.-based; really doesn't matter) that talks to APNS. Two pieces of software.

Core Location itself is fairly easy. You create a CLLocationManager object, like so:


CLLocationManager * locationManager = [[CLLocationManager alloc] init];
locationManager.delegate = self;
locationManager.distanceFilter = kCLDistanceFilterNone; // whenever we move
locationManager.desiredAccuracy = kCLLocationAccuracyHundredMeters; // 100 m
[locationManager startUpdatingLocation];


…and then, having made yourself the delegate, wait for a callback:


- (void)locationManager:(CLLocationManager *)manager
didUpdateToLocation:(CLLocation *)newLocation
fromLocation:(CLLocation *)oldLocation
{
// do stuff with the old and new location here
}

evan
2010-07-21, 11:10
thanks chucker, now to look into how to set up a server...