多人连接:iOS 和 Android

Multipeer Connectivity: iOS and Android

我正在与一个跨平台应用程序团队合作(Android 和 iOS)。

此应用旨在使用 beacons and/or mesh networkingmultipeer-connectivity 的概念。目前,我们的团队正在使用 Xamarin 作为我们的 IDE 来创建单个代码库。

经过大量研究(显然不够重要),我只能找到以下资源..

http://altbeacon.org/

http://altbeacon.github.io/android-beacon-library

https://github.com/octoblu/meshblu

https://github.com/octoblu/MeshbluKit-iOS

https://github.com/octoblu/MeshbluKit-Android

https://github.com/CharruaLab/AltBeacon

https://blog.xamarin.com/play-find-the-monkey-with-ios-7-ibeacons/

几个问题:

AltBeacon 是否允许平台间通信?

在 Xamarin/C# 中是否有建立 Multipeer/Mesh 网络的内置方法?

Estimote 是否需要使用 stickers/estimote 信标,或者智能手机可以充当信标?

我要找的是:

  1. 一种在用户没有 WiFi 或“数据”连接时在 iOS 和 Android 设备之间建立连接的方法。

  2. 基本上每个设备都会充当彼此的“信标”。

  3. Xamarin/C# 是必须的(尽管我会听到其他解决方案,如果它们令人信服的话)

  4. 这个场景:

Two individuals walk pass one another. Both have the app running on their phones. One individual has an iphone and the other has an android. Their apps are running in the background (their phones are in their pockets or hands and are locked.. meaning not in "use"). As the individuals walk past each other their phones detect one another and send/receive text from one another

在此事件发生之前,用户 1 使用该应用保存了包含以下信息的便条...

"Water fountain working properly"

虽然 用户 2 在他们的设备上使用该应用程序来保存包含以下信息的笔记...

"Hand rail slightly damaged"


在用户经过彼此之后,下次他们打开他们的应用程序时,他们应该会看到一条更新的笔记阅读...

"Water fountain working properly

Hand rail slightly damaged"


可能的解决方案:待定

被拒绝的解决方案:待定

--

目前的结论: 当前存在的应用程序有 FireChat、ViewRanger(我相信)或 Xamarin 示例“Find the Monkey”。 Apple 在其商店中使用 iBeacon,而其他人则在 android 设备中使用 AltBeacon。我得出的结论是,这当然是可能的,但我正在寻找如何最好地执行它,同时让两个平台充当彼此的信标。

"我要找的是: 一种在用户没有 WiFi 或 "data" 连接时在 iOS 和 Android 设备之间建立连接的方法。 本质上,每个设备都将充当彼此的 "beacon"。 Xamarin/C# 是必须的(虽然我会听到其他解决方案,如果他们有说服力的话)"

BLE(低功耗蓝牙)就是您要找的,而不仅仅是其中的 iBeacon 部分。

iBeacon 建立在 BLE 堆栈之上,通过设置 "manufacturer specific data"(Apple 所做的)BLE 广告包。 iBeacon 工作在 BLE "broadcast" 模式,它只传输三个数据字段 UUID,major(16 位),minor(16 位)。另外 RSSI(信号强度为 transmitted/calculated)。

不好的是,如果您使用 iOS 核心位置或任何其他 iBeacon 库,它将与 UUID、主要、次要、RSSI 一起工作。 您不能通过标准 iBeacon 协议传输任何附加数据。

  1. 您正在寻找的是 iOS 的 CoreBluetooth 或 Android 上的低功耗蓝牙库。
  2. 您可能必须使用 GATT/ATT BLE 层创建自定义配置文件(因为 existing 中的 none 可能不符合您的要求)
  3. 您需要在 BLE 配置文件设置上开发应用程序

请记住,BLE 是低功耗和低速通信,您可以预期(根据我在许多不同平台上的测试)每 25-30 毫秒最多 20 个字节

希望这对您有所帮助...

根据您的场景描述,可以将其分解为 2 个简单的步骤:

  1. 正在发现附近的设备
  2. 发现后交换简单数据

必需:这应该适用于 x 平台 iOS 和 Android

我认为解决这个问题的最佳方法是使用 BLE,这两个平台都支持(有些比其他平台更好)。

在 iOS 上,设备可以同时充当 BLE Central 和 BLE Peripheral,在 Android 上,情况更加复杂,因为并非所有设备都支持 BLE Peripheral 状态。此外,Android BLE 堆栈非常不稳定。

如果您的用例是功能驱动的,我建议您查看可以为您实现此目的的框架和库,而无需从头开始构建它。

例如: http://www.p2pkit.io, http://www.intromi.co and http://www.underdark.io 或 google 附近

关于在 Xamarin 中使用本机代码,您可以简单地创建一个桥接器(绑定:https://developer.xamarin.com/guides/ios/advanced_topics/binding_objective-c/)。

免责声明:我为 Uepaa 工作,为 Android 和 iOS 开发 p2pkit.io。