开发者

How do you send GPS coordinates from one android phone to another?

I am writing a android application that will hopefully let me and a few friends see where each other are. It requires each phone to send the gps coordinates to each other. Is there anyway to do that in the SDK / Java? Each device that will be included开发者_开发问答 will be hard coded and can't be changed. Thanks for any help I can get!


There is no special trick to passing around GPS coordinates. You'll have to used standard ways like setting up a central server to receive and broadcast some coordinates or you could use SMS's to pass the details around automatically.


Rather than trying to connect to each of the devices directly, you might want to consider having each device store its location on a server somewhere. That has several advantages:

  1. The server is easy to find. It's address is known by all the devices.

  2. Each device only needs one network connection to get the latest locations of all the other devices. It might not be a big deal for three devices to all connect to each other, but it's a problem for as few as one or two dozen devices.

  3. The server is more likely to be reachable.

Using a server doesn't have to be complicated. All you really need to do is let each device post a file to a common directory.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜