I want to add UDP communication to my game to offer a multiplayer experience. Because I want to release my app, it's absolutely necessary that the UDP communication works constantly on all (or at least the majority of) devices (API Level 8+).
I primarily want to use MulticastSockets, but it seems that Multicast is not working correctly on a plurality of devices, and there is no way to fix that.
So I have to find an alternative. One option might be to broadcast UDP communication.
Do targeted Android devices constantly support broadcasting? If not, which other options exist?
Related
I am currently trying to develop a mobile application for both iOS and Android. It basically will be a game buzzer app, determining which of the players is granted a right to answer a specific questions.
The problem is that I struggle to determine which technology / framework I should use for that. Now, some details:
In this app there will be a "base" - it is the phone that gives
"start" signal for all the other players. Each buzzer pressed before this signal corresponds to a false start. Eventually, information
about which player is granted a right to answer or is penalized due
to false start should be displayed on the base device.
App is done for people who have no access to the internet. All the
communication should exists given ONLY mobile phones with no data
plan.
Max number of communicating devices is 9 (1 base and 8 players)
I investigated a lot of resources and this is what I discovered:
Regular WLAN with TCP sockets and etc won't help, since it assumes that all devices are connected to same wireless access point - it violates my requirements.
Regular bluetooth won't help either. This would work across a specific platform, but making Android talk to iOS is impossible.
Situation with Wi-Fi direct is same as with regular bluetooth. Both platforms support this, but Apple's MultipeerConnectivity framework works only with iOS devices.
Now the last option I am left with is BLE. Both platforms support this and are able to intercommunicate (acting both as central or peripheral devices). However, due to my requirements for an app, I assume that base device should act as peripheral, and according to (sometimes conflicting) articles on Internet, one can't connect several central devices to single peripheral.
Now, my questions:
I still assume I might have done some mistakes in the bullet points above, so please, correct me if I am somewhere wrong.
Now when I am left only with BLE option, are there any possible solutions to the above issue? Maybe it is possible to use all devices as centrals (?). I recently saw this example, where everything works cool. Sorry in advance, if I said something stupid.
Of course, there is a counterexample - FireChat, which employs OpenGarden's MeshKit. But the framework is not available. I tried communicating OpenGarden people, but no response. Does anyone know if it is planned to go opensource soon, or maybe there exists any analog of this?
Try the Hype SDK by Hype Labs. It's a multi-transport, multi-hop mesh SDK. It supports interoperable Bluetooth Low Energy (and other transports as well). The SDK is currently in private beta but will be made available upon approval of the subscription.
I need some guidance on a project im currently working on - I work on a project to communicate with a BLE device s.t. the device is connected to an android phone and transmits some data once in a while. I saw some lectures on BLE communication with android devices and read some information on the android 4.3 bluetooth API but there are some things I didnt got yet
In case I want my app to be compitable backward (up to 2.3) is that possible? did they (Google) include the new features on the support package?
Where can I find some good code example of using the android as a client?
When communicating with an android device I need the charestirestic of the bluetooth device to have UUID, do I generate some UUID's on the run? (and in that case how) or do I hard-code them on the app? (since on that case two people using this app and close to each other basically can read each other's signal, don't they?)
In case I want my app to be compitable backward (up to 2.3) is that possible? did they (google) include the new features on the support package?
Bluetooth low energy needs to be supported by the HW and there are only a handful of devices with the necessary Bluetooth radio running an older version of Android. For sure no device running 2.3 will be able to run BLE.
Where can I find some good code example of using the android as a client?
The examples provided on developer.android.com is actually quite good
When communicating with an android device I need the charestirestic of the bluetooth device to have UUID, do I generate some UUID's on the run?
Bluetooth Special Interest Group has already created a bunch of assigned numbers. These have a well defined meaning across all BLE devices and services. Then businesses can apply for a range of UUID's that they can use to defined there own services.
On top of that there are some free ranges where everyone can define and use UUID's. These will not be well defined across devices, meaning other applications will not understand the UUID's you've defined.
I am thinking of developing an Android app that would, as part of it's function, send-to and receive-from broadcast messages from all devices that are currently connected to a WiFi network.
While a lot of developers have suggested that such a requirement would need the application to acquire the MulticastLock, there are experiences out there that say:
Acquiring the MulticastLock successfully cannot be relied upon since the acquire() method does not return any status on the operation requested.
And even if you do acquire the lock, it's not guaranteed that the WiFi stack does not filter out packets that are not directed at the device.
There are others that say multicastlock works reliably on versions 2.3.3 and above and that the problem of reliability is only for devices running 2.3.2 and below.
Some of them say nothing is guaranteed (now or for future devices) as support for broadcast and multicast is a chipset controlled functionality and that OEMs have the final say. They cite battery drain being the primary motivation for OEMs to either allow or deny software configuration of the chipset.
So, before i delve into my project, i wish to know what the current state of this issue is and if what i am trying to do is feasible i.e no guess work involved. If there is a work around, i am willing to implement that as long as i know it will work reliably. Kindly share your opinions and experiences. Thanks in advance.
I have used Android apps based on DLNA (like iMediaShare and WDTV Live Media Player) that use multicast for Discovery and Streaming, albeit, this was on JellyBean and not on pre 2.3.3. The apps were able to discover other devices on the network. This could very well be a pre 2.3.3 issue.
Both the apps mentioned above say that their app works with Android version 2.1 or 2.2 and up
I've been reading up on how to transfer data between iOS devices over Bluetooth using GameKit. I'm not writing a game, per se, but do have a need to transfer a small amount of binary data between two devices. Between two iOS devices, this is easy enough. However, I was wondering if it is possible to transfer data between an iOS device and an Android device via the same mechanism.
Has anyone come across documentation/tutorial that would explain how to do this? Is it even technically possible? Or has Apple put in some sort of restriction that would prevent this?
The other option I discovered was Bonjour over Bluetooth. Would this be a more suitable option for this type of operation?
This question has been asked many times on this site and the definitive answer is: NO, you can't connect an Android phone to an iPhone over Bluetooth, and YES Apple has restrictions that prevent this.
Some possible alternatives:
Bonjour over WiFi, as you mentioned. However, I couldn't find a comprehensive tutorial for it.
Some internet based sync service, like Dropbox, Google Drive, Amazon S3. These usually have libraries for several platforms.
Direct TCP/IP communication over sockets. (How to write a small (socket) server in iOS)
Bluetooth Low Energy will be possible once the issues on the Android side are solved (Communicating between iOS and Android with Bluetooth LE)
Coolest alternative: use the Bump API. It has iOS and Android support and really easy to integrate. For small payloads this can be the most convenient solution.
Details on why you can't connect an arbitrary device to the iPhone. iOS allows only some bluetooth profiles to be used without the Made For iPhone (MFi) certification (HPF, A2DP, MAP...). The Serial Port Profile that you would require to implement the communication is bound to MFi membership. Membership to this program provides you to the MFi authentication module that has to be added to your hardware and takes care of authenticating the device towards the iPhone. Android phones don't have this module, so even though the physical connection may be possible to build up, the authentication step will fail. iPhone to iPhone communication is possible as both ends are able to authenticate themselves.
Maybe a bit delayed, but technologies have evolved since so there is certainly new info around which draws fresh light on the matter...
As iOS has yet to open up an API for WiFi Direct and Multipeer Connectivity is iOS only, 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 (to date).
If your use case is feature driven, I would suggest to look at Frameworks and Libraries that can achieve cross platform communication for you, without you needing to build it up from scratch.
For example: http://p2pkit.io or google nearby
Disclaimer: I work for Uepaa, developing p2pkit.io for Android and iOS.
You could use p2pkit, or the free solution it was based on: https://github.com/GitGarage. Doesn't work very well, and its a fixer-upper for sure, but its, well, free. Works for small amounts of data transfer right now.
I have been searching for a while now and decided to post a question here to see if someone had already traveled down this specific road.
I am developing a bluetooth enabled device, using the Bluegiga BLE112 chip. They announce this chip to be easily used with iOS devices (and this was our main reason for choosing it)
The device will need to communicate with an App, that we need to be developed for iOS, Android, Windows Phone, and Blackberry. Due to this need, I've decided to use Rhomobile, as it seems to be the only one that supports developing BT apps for iOS without having to develop further plugins.
I only need to send small messages (like commands, small strings) and sometimes a bigger file to the device's internal memory.
On Rhomobile's BT documentation, they state that for iOS it is only possible to comunicate between iOS devices ( i'm thinking that they say this because of the MiFi limitations imposed by Apple, but that using Bluegigas chip are not a problem...)
My question is:
Since Bluegiga's documentation has examples of devices communicating with iOS using their chip, i should be able to develop using Rhomobile and not suffer from the limitation stated above. I wanted to be as sure as possible before making my company spend money ordering the chips and development board and what not..
Has anyone tried this, is my thinking missing something?
Thank you all for your time.
Daniel
Good Question, I think I can understand the reason for your confusion.
The main reason is many people/products/frameworks does not clearly mention if they are talking about Bluetooth Classic or Bluetooth Low Energy (BLE).
These are both 2 different things and even thougfh they are called "Bluetooth" one cannot talk to the other.
(Some devices can be both Classic and Bluetooth Low Energy, which allows it to connect to either types)
Ok now comming to your Question :
THE bluegiga dongle is BLE
The Rhomobile is refering to the Bluetooth Classic version of the API.
On iOS the BLE APIs are open to applications, but Classic is limited on iOS , one way for Apps to use Classic Bluetooth on iOS is via the Gamekit APIs but that is possible only when talking with iOS devices, so it wont connect to another Android or Win device that is also Classic.
Needless to say with BLE APIs you cannot connect to calssic anyways.
The bluegiga examples are BLE examples, and apple also has good documentation and examples / samples on how to use BLE so yes it is easy to build a device and app using BLE on iOS.
There is nothing special abut any particular chip yo ucan use any BLE chip - there are many vendors today.
BUT Android (and I guess Windows as well) does not yet have BLE APIs for applications to use :( (Bit I think is is comming soon :))
So I hope this clears things up a bit.