开发者

What is the best way to detecting distance between two iphone/ipod/ipad?

开发者 https://www.devze.com 2023-01-23 14:33 出处:网络
I only can think to use GPS location to calculate the distance ... What if the two device is in the same building,but different floor

I only can think to use GPS location to calculate the distance ...

What if the two device is in the same building,but different floor

How to get the vertical distance ?

o开发者_JS百科r any better ideas ???


GPS is probably going to be your best bet, although it only tends to be accurate within a few meters.

Fortunately, you can deal with vertical distance if you have a 3D lock with the GPS. This will provide you with latitude, longitude, and altitude. Enough to allow you to calculate 3D vector between any two points.

Here's a quick demo utilizing altitude in Core Location:

http://www.vellios.com/2010/08/18/ios-core-location-gps-tutorial-pt-2/


It does not sound possible to do what you want. That said...

GPS sounds like your only option to get the location that is as accurate as you want.

If you need to make sure that they are close enough for Bluetooth, use GameKit and it will search automatically for devices in range.

For vertical difference, you can try using the Gyro in iPhone 4, but I'm not sure that would work either.

As a last ditch effort, perhaps the proximity sensor may work for close range checking.

0

精彩评论

暂无评论...
验证码 换一张
取 消