Is peer-to-peer communication over 3G/4G possible for smart phones?

爷,独闯天下 提交于 2019-12-09 06:59:59

问题


I'm trying to write an app that transfers data from one android device to another - but the devices are most likely located in different parts of the city, state, or country. (The straight forward way would be to have a central server (or any type of server), but i'm trying to avoid using one).

The data I'm trying to pass is text, pictures, or a combination of both.

The solution I've found so far is to communicate with specially formatted text or picture messages; but that seems far from optimal. Any better solutions?


回答1:


True P2P isn't possible over 3G.

In your question, you mention that you currently use messages. I assume that you mean SMS.

What you could do instead is using mails and attachments with a custom mime type, say application/foobar-data.

Within your app one could launch a SEND intent containing this attachment. The user would then have to choose his email program (or this could maybe be automatic), and send it to whoever he/she likes. You may also specify the To: address, and the subject in your intent. This would be rather straightforward.

The remote user would then receive this mail and tap on the attachment. Your app would be registered to handle the application/foobar-data mimetype, using an intent filter in the manifest, and would then automatically launch and receive the data. The body of the mail generated earlier could also be pre-filled with informations about your app and how to install it, such as "You need FooBar to view the attachment. You can install it from...".

And so, in the end, your app could both send custom data and receive it, without relying on a dedicated server.




回答2:


Use Amazon Simple Queue Service:

Amazon Simple Queue Service (Amazon SQS) offers a reliable, highly scalable, hosted queue for storing messages as they travel between computers. By using Amazon SQS, developers can simply move data between distributed components of their applications that perform different tasks, without losing messages or requiring each component to be always available




回答3:


Look at ShazzleMail. You can download their app and communicate p2p over a smartphone. Addressing is done through a middleman, but all content goes p2p.



来源:https://stackoverflow.com/questions/5648972/is-peer-to-peer-communication-over-3g-4g-possible-for-smart-phones

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!