智能手机是否可以通过3G/4G进行对等通信? [英] Is peer-to-peer communication over 3G/4G possible for smart phones?

查看:97
本文介绍了智能手机是否可以通过3G/4G进行对等通信?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试编写一个将数据从一个Android设备传输到另一个Android设备的应用程序-但这些设备最有可能位于城市,州或国家/地区的不同地区. (最直接的方法是拥有一台中央服务器(或任何类型的服务器),但我试图避免使用一个).

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?

推荐答案

在3G上不可能实现真正的P2P.

True P2P isn't possible over 3G.

在您的问题中,您提到您当前正在使用消息.我认为您的意思是短信.

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

相反,您可以使用具有自定义mime类型(例如application/foobar-data)的邮件和附件.

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

在您的应用程序中,您可以启动包含此附件的SEND意图.然后,用户将不得不选择他的电子邮件程序(或者这可能是自动的),并将其发送给他/她喜欢的任何人.您还可以指定收件人:"地址和意图中的主题.这将非常简单.

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.

然后,远程用户将收到此邮件,然后点击附件.您的应用程序将使用清单中的意图过滤器进行注册,以处理application/foobar-data模仿类型,然后将自动启动并接收数据.先前生成的邮件正文也可以预先填充有关您的应用程序以及如何安装的信息,例如您需要FooBar来查看附件.您可以从...安装它."

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.

这篇关于智能手机是否可以通过3G/4G进行对等通信?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆