Multipeer Connectivity: iOS and Android [closed]
Asked Answered
J

2

7

I am working with a team on a cross platform app (Android and iOS).

This app is meant to use the concept of beacons and/or mesh networking or multipeer-connectivity. At the moment our team is using Xamarin as our IDE for creating a single code base.

After significant research (obviously not significant enough), I have only been able to find the following resources..

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/

A couple of questions:

Does AltBeacon allow communication between platforms?

Is there a built-in way to establish Multipeer/Mesh networking in Xamarin/C#?

Does Estimote require the use of stickers/estimote beacons, or can a smartphone act as a beacon?

What I am looking for:

  1. A way to establish connections between iOS and Android devices when the users have no WiFi or "data" connection.

  2. Essentially each device will act as a "beacon" to each other.

  3. Xamarin/C# is a must (though I will hear other solutions if they are convincing)

  4. This scenario:

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

Prior to this event taking place, User 1 used the app to save a note containing the following information...

"Water fountain working properly"

While User 2 used the app on their device to save a note containing the following information...

"Hand rail slightly damaged"


After the users have passed each other, the next time they open their app they should see a single updated note reading...

"Water fountain working properly

Hand rail slightly damaged"


Possible Solutions: TBD

Rejected Solutions: TBD

--

Current conclusions: Apps currently exist such as FireChat, ViewRanger (I believe), or the Xamarin example "Find the Monkey". Apple uses iBeacons in their stores and others use AltBeacon for android devices. I have concluded that it is most certainly possible but am in search of how to execute it best while having both platforms serve as those beacons to each other.

Jacquie answered 1/4, 2016 at 21:19 Comment(4)
What conclusions have you found? Have you actually written up a proof-of-concept application?Glantz
Good questions, I've updated my post.Jacquie
On iOS the device cannot act as a beacon in the background. Also iBeacons etc only advertise 3 identifiers. They do not exchange information. You will need to implement BLE peripheral & central roles. On iOS this is via Core Bluetooth. I don't use Xamarin but I have seen core Bluetooth questions on it, so it is supported. I presume this is also true on for Xamarin on android via the appropriate android libraries although I have no idea how portable the c# code would be. I suspect you will need specific implementation for each platformCouching
What you want to do is very possible using native bluetooth libraries on Android and iOS. However, you will need plenty of platform specific optimizations to make it work quickly enough to trigger users when they come near one another. IMO, it is not realistic to expect to do those optimizations with Xamarin, because it just won't give you fine-grained enough control.Highams
M
4

From the description of your scenarios one can break it down to 2 simple steps:

  1. Discovering nearby devices
  2. Exchanging simple data upon discovery

Required: this should work x-platform iOS and Android

I believe the best way to approach this is to use BLE, which is supported by both platforms (some better than others).

On iOS a device can act both as a BLE Central and BLE Peripheral at the same time, on Android the situation is more complex as not all devices support the BLE Peripheral state. Also the Android BLE stack is very unstable.

If your use case is feature driven, I would suggest to look at Frameworks and Libraries that can achieve this for you, without you needing to build it up from scratch.

For example: http://www.p2pkit.io, http://www.intromi.co and http://www.underdark.io or google nearby

With regards to the use of native code with Xamarin you can simple create a bridge (Binding: https://developer.xamarin.com/guides/ios/advanced_topics/binding_objective-c/ ).

Disclaimer: I work for Uepaa, developing p2pkit.io for Android and iOS.

Madson answered 5/4, 2016 at 13:9 Comment(1)
Awesome! Actually started using underdark before you posted this. Checking out p2pkit.io and intromi.co now. I'll check this as the answer in a couple days as it provides the most useful information for me now.Jacquie
L
2

"What I am looking for: A way to establish connections between iOS and Android devices when the users have no WiFi or "data" connection. Essentially each device will act as a "beacon" to each other. Xamarin/C# is a must (though I will hear other solutions if they are convincing)"

BLE (Bluetooth Low Energy) is what are you looking for, not just iBeacon part of it.

iBeacon is built on top of BLE stack, by setting "manufacturer specific data" (which Apple did) of BLE advertisement packet. iBeacon works in BLE "broadcast" mode and it transfers only three data field UUID, major (16-bit), minor (16-bit). Additionally RSSI (signal strength is transmitted/calculated).

The bad thing is that if you use iOS core location or any other iBeacon library it will work with UUID, major, minor, RSSI. You can not transfer any additonal data over standard iBeacon protocol.

  1. What you are looking is CoreBluetooth for iOS or Bluetooth Low Energy library on Android.
  2. You probably have to create your custom profile using GATT/ATT BLE layers (since none of existing probably wont fit to your request)
  3. You need to develop app over your BLE profiles setup

Keep in mind that BLE is low power and low speed communication, where you can expect (from my tests on many different platforms) up to 20 bytes every 25-30ms

Hope this helps...

Liard answered 1/4, 2016 at 22:5 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.