17

First of all I am an Android developer, so the question goes to all the iOS developers.

Is it possible to achieve an Android <-> iPhone/iPad direct communication?
Some claim it is not possible, others claim it is.

I guess two possible technologies would be Bluetooth and/or Wi-Fi Direct.
Wi-Fi Direct is not recommended because it is not supported by Gingerbread and as far as I know, it is not supported by iPhone either (maybe iPhone 6, as I have heard from rumors)

It is already known that Bluetooth communication is achieved between iOS devices using GameKit and here is a reference.

I don't understand what is so special when communicating with GameKit??
Are the messages wrapped in some way with extra bytes at the beginning and ending of the message? Fine, we can wrap the messages the same way in Android!
Are the messages encrypted?!! And if so, could we decrypt them when they are received in an Android device?

Any ideas, workarounds, or other hackerish solutions are mostly welcome!

Community
  • 1
  • 1
George Pligoropoulos
  • 2,919
  • 3
  • 33
  • 65
  • 2
    well the question you are referring as duplicate was asked over a year ago. Someone would expect recent updates on the matter. But thanks for linking the question – George Pligoropoulos Apr 03 '13 at 09:21
  • some related info in this link: http://is.gd/i2UbhE but still cannot find a good answer because I guess the android bluetooth api is a higher level (as easy as working with input-output streams) and for the iOS solution you have to go deeper from what I can tell.. – George Pligoropoulos Apr 03 '13 at 11:48
  • 1
    Perhaps in slight delay, but technologies have since evolved: The current state is that connection between iOS and Android is possible over BLE, however still many Androids do not support BLE Peripheral mode, plus the Android BLE stack is very unstable. In addition, WiFi Direct is supported by Android, but on iOS it is not yet publicly available. If i may, i would recommend looking at frameworks that can do cross platform p2p for you so that you dont need to spend your time writing networking code. Such frameworks could be the one i am working on called http://p2pkit.io or google nearby. – p2pkit May 10 '16 at 15:38

3 Answers3

16

There are three frameworks available in iOS using which you can develop the bluetooth applications:

1. GameKit: This is the publicly available framework . But using this you can only establish and communicate between only two iOS device. So this framework having its own limitations .

2. BluetoothManager: This is private framework .I used this framework to discover the non iOS devices . I have established the connection also . But cant able to do the data exchange. I think it is still under development. For the reference you can refer this link

3. CoreBluetooth: This is also the public framework. This can only discover BLE enabled devices . I have successfully used this to transfer the data between the BLE enabled devices.

V-Xtreme
  • 7,230
  • 9
  • 39
  • 79
  • 1
    You said you successfully transfered data between BLE enabled devices through CoreBluetooth. What kind of BLE devices are you talking to ? Can you confirm me/us you did successfully transfert datas to an Android device like the Samsung Galaxy S4 or a Nexus 4 ? Or just a BLE pin ? @V-Xtreme – klefevre Jun 18 '13 at 09:50
  • @kl94: For the data transfer you just require two BLE enabled device no matter whether they are iOS device , android device or BLE modem . If you can able to render the levels like peripheral, service and characteristic you can do any operation with the characteristic depending upon the property of the characteristic i.e. Read/Write/Notify – V-Xtreme Jul 17 '13 at 04:00
  • Just an FYI for someone messing around with CoreBluetooth, here's a link to some example source code provided by Apple: https://developer.apple.com/library/ios/samplecode/TemperatureSensor/Listings/TemperatureSensor_main_m.html#//apple_ref/doc/uid/DTS40012194-TemperatureSensor_main_m-DontLinkElementID_12 – Art Geigel Sep 24 '13 at 21:13
  • I have a device **"socketMobile"** Sensor of barcodes. This device not appear in list when i implemented CoreBluetooth option. How i know when a device is BLE or an Common Bluetooth?. Later i implemented the BluetoothManager.framework and this works correctly, But when i try compile, xcode (or itunnes connect) show problems because this is a private library. I need other solution please.. Thanks – jose920405 Mar 16 '15 at 13:12
  • @V-Xtreme, Can I connect to a gimbal which has BLE enabled. And to send commands to change its movements from an iOS app? Do you have any sample link for such communication? – Hemang Jul 27 '16 at 22:43
3

iOS does not implement any standard Bluetooth protocols that would allow it to communicate with other OS'es. GameKit is proprietary and if it were easy to hack it then people would have already done so (and Apple would have closed the hole).

Bluetooth LE is only supported by few Android devices (it is not in AOSP yet) so it is not really useful yet, even if it did support peer-to-peer.

I've read that it is possible to do what you are after via Wi-Fi direct, e.g. with this library: https://www.alljoyn.org/ It says that it supports both Android & iOS - I haven't tried it myself, but it appears to do what you are after.

Tom
  • 17,103
  • 8
  • 67
  • 75
1

For devices on the same local network, Bonjour (a.k.a. zeroconf) can be a good way for processes on different machines/devices to discover and interact with each other.

See apple bonjour for android for some pointers to an Android implementation of Bonjour.

Community
  • 1
  • 1
Caleb
  • 124,013
  • 19
  • 183
  • 272
  • same local network? Nop! Devices do not belong to a local network. In fact no network is supposed, nor an internet. This is why I mentioned wifi-**direct** and not simple wifi, and also this is why bluetooth is important – George Pligoropoulos Mar 23 '13 at 01:10
  • Hi @Caleb i need to create my own app for such communication is that possible? – Gopi.cs Apr 09 '13 at 10:38
  • While I was not able to discover a bounjour service (CocoaHTTP library) running from my iPhone I was able to hardcode the IP address of the iPhone hotspot (default is 170.20.10.1) and port and connect to it on Android and retrieve a web page hosted on the iPhone. – Fraggle Dec 07 '13 at 20:47
  • I think the question regarded p2p direct communication. In that case the Bonjour C library on iOS is of no help because: It is using a closed source implementation to detect p2p devices over Classical bluetooth connection, which is not supported by Android. – p2pkit May 10 '16 at 15:32