I'm looking for a way to detect iBeacon (iOS 7.0 feature) from an Android device. I read the Android documentation, where it seem that the iBeacon is some kind of GATT server which sends its position. While the Android documentation says that I should not poll that data, but for the detection this would be nessesary.
I google a lot but this topic is quite new (I even created a new tag ibeacon) so I would be happy if I get some links to ressources from the iOS world which descripes the implementation. Also if there are some Android libs which I did not find yet would be nice.
EDIT: The library below has been moved here:
https://github.com/AltBeacon/android-beacon-library
I have ported the iOS7 iBeacon SDKs to Android, and was able to see standard iBeacons and estimate their range. The code is available here:
https://github.com/RadiusNetworks/android-ibeacon-service
For this to work, you need Android 4.3 which introduced the Low Energy Bluetooth APIs. You also need a device with a low energy bluetooth chipset.
If you don't want to use the full library above, you can roll your own. iBeacons simply transmit a BLE advertisement once per second that start with a known sequence of bytes. You simply have to tell Android to do a BLE scan, get each advertisement, and look for one that starts with the known iBeacon byte sequence. You can then parse out the iBeacon fields. Here is the code the shows how this is done:
https://github.com/RadiusNetworks/android-ibeacon-service/blob/master/src/com/radiusnetworks/ibeacon/IBeacon.java#L177-L231
The only catch here is to detect beacon even the app is not running. Unlike iOS7, it is not natively support. In iOS7, when you on your BT, it will automatically notify you when you enter the region of registered iBeacon.
I had implemented iBeacon in Android 4.3 API using IntentService plus AlarmManager. To do a scan every 30 sec( to save your battery power, it shall be longer). It works well for user. Only when the matching uuid/major/minor is found, then it will trigger notifications. Otherwise, it will sleep and wake up for scanning again.
i think this is the solution for your question.
I didn't quite get what you mean, could you provide links to the documentation which said that you should not poll the data?
But it seems to me that the iBeacon is working as a server, which is kind of funny to me. Isn't it meant to find other devices, not the phone itself?
https://developer.bluetooth.org/gatt/characteristics/Pages/CharacteristicViewer.aspx?u=org.bluetooth.characteristic.position_quality.xml
This is the characteristics it uses though. To me it sounds like that the devices you are looking for are the "beacons" and the phone itself is just a listener. So you would not poll the EHPE and EVPE data but you should actually listen to it's changes or "broadcasts".
I'm kind of new to this myself also and couldn't find any really specific documentation.
Though, be advised, in the link I provided there is download link in the top corner which will provide you the full documentation in PDF format. There you will probably find more answers.
Related
I am trying to implement my own universal pattern to deal with every kind of iBeacons. Till now I had most contact with Estimote beacons. Estimote API allows me to connect with beacon and change parameter programatically. However patterns I am creating are based on http://developer.radiusnetworks.com/ android lib. I have finished implementing almost everything (monitoring, ranging, advertising intervals, setting beacons, checking bluetooth, managing service life on boot/background etc.) but I can't find any option to change iBeacon parameters. Problem is, that their documentation disappeared from their git 3 days ago, examples too. And I have problem.
Is there any general way, maybe low-level, like directly connecting with BLE device via bluetooth, changing some characteristic etc. to change minor/major/txPower programatically? I appreciate any hints in this matter.
Unfortunately, there is no standard way to configure a beacon's identifiers. Each vendor uses a different proprietary technique, some using a Bluetooth connection, some via other means, and some do not allow it at all.
These proprietary techniques are generally not published. So if you want to make something universal, you will have a big task of getting each vendor's configuration spec (or reverse engineering it if unpublished), and implementing each one.
As the author of the library you mention, I can assure you it contains no code to do this configuration for any beacon. That library was for detection, not configuration.
i am new to Ibeacon and i want to know can we detect Ibeacon in android without using any SDKLibrary or library can any one give sample example.
i know some library like Radius Networks. but i don't want to use any library
The Android OS does not have any code that detects iBeacons, but it does have code that allows you to scan for Bluetooth LE devices, which are a lower-level device than an iBeacon.
You can roll-your own code that detects iBeacons using this Bluetooth LE scanning. That's exactly what the Android iBeacon Library from Radius Networks does. It is open source, so if you don't want to use the library, you can simply copy blocks of code out of the library and do your own detection.
The source code is here: https://github.com/RadiusNetworks/android-ibeacon-service
EDIT: the library has been moved to http://github.com/AltBeacon/android-beacon-library
If you detection use cases are very simple, this might work fine. Be careful not to bite off too much work, though, because handling all the edge cases can become increasingly complex. That's certainly what I learned when writing the library.
If you just want to play with this, I would focus on one class from the library: IBeacon.java
This class can convert from an Android Blueooth LE scan record to an IBeacon (if the scanned Bluetooth device is indeed an iBeacon)
You can read about how to set up Bluetooth LE scanning on Android here: http://developer.android.com/guide/topics/connectivity/bluetooth-le.html
There is a new small library: https://github.com/inthepocket/ibeacon-scanner-android
Without a library it's very easy to scan for ibeacons, you just need to create the correct ScanFilter, based on the iBeacon, and then start a BLE scan. Creating the correct ScanFilter can be hard at first, best have a look at the code in the mentioned library.
Dependant on Android version, location needs to be turned on, location permission needs to be granted and bluetooth, always, needs to be on.
I'm creating an app in which a key piece is transferring data when two people press a button on the app on their respective devices and then press their phones together (Yes, Bump on Android does this. That isn't the point). I know I could use NFC on Android to get this done. However, I wouldn't be able to do this on iOS because iOS doesn't support NFC. Earlier today I read about and discovered iBeacon, which is apparently some Bluetooth 4.0 implementation that works with both iPhones and Android devices. I've read about retail use-cases of iBeacon, where stores could set up beacons and when users walk by or are close enough, it'll trigger an action. Is the use-case of mimicking NFC for my purposes to be able to do reach iPhone users plausible? Should I be using another solution? Is this not the purpose of iBeacon and it wouldn't work?
From my experience with iBeacon on Android, you can indeed use it to replace NFC, as there are 3 'ranges' (immediate, near and far). iBeacon is based off BLE (Bluetooth Low Energy) and very light on power consumption as the name would suggest.
If you are trying to trigger actions on devices in a certain vicinity, i'd say using iBeacon is the most plausable method.
Android doesn't natively support 'iBeacon' as Apple created it, but it is based off Blueooth 4.0, a library has been created to mimick the iOS implementation of iBeacon
Android iBeacon Library
One thing to note, is that when using iBeacons, you cannot transmit data. Only two numbers (a major, and minor) and a UUID used solely for identification purposes.
The main problem with using iBeacons for this is that iBeacons are transmit only devices designed only to alert phones to their presence. The technology cannot exchange data.
You could do something like you describe with low-level programming with Bluetooth LE technologies, but iBeacons alone cannot do the job.
We were given a bluetooth device that we were asked to connect both iOS and Android devices to a particular custom peripheral.
The demo app seems to bring up a list of devices, asking which to use, then brings up a list of protocols, which includes one defined in the info.plist under "Supported external accessory protocols" as com.(company).bt.
I looked all over and found nothing about this process being standard with Bluetooth, and the entire workflow appears to be different on Android. I've tried using the bluetooth sample app to connect to this device but the red connected LED never lights up, and depending on the UUID given, I either receive 1 byte or 7. The sample code I was given doesn't even touch the InputStream unless the stream has reached 16 bytes (Which of course, never happens)
Is there some sort of guide on how to connect to this device? Based on what I read from the code, a message isn't even sent until the user presses a button, but the LED is lit long before this is even an option in iOS.
Edit: I finally found something from clicking around - it seems that the plist entry has to do with mfi (Which I guess the documentation is only available to those in the program?) With that said, does that mean this device will only work with iOS devices?
As you mentioned connection in Android and iOS is done differently.
The protocol defined in info.plist should be the protocol you are meant to use with the particular Bluetooth chip you have.
There is a guide explaining how to connect in iOS, you should probably also check which Bluetooth version it is. If it is lower than Bluetooth 4.0 (BLE- Bluetooth Low Energy) or not. I assume it isn't BLE since you mentioned it is MFI...
1)If it is BLE use Core Bluetooth
2)Otherwise have a look at the following link: Introduction to Stream Programming Guide for Cocoa.
It is a bit hard to understand what you mean about the red LED because we don't know what device you are using. Considering you are receiving some bytes from the device it means that the communication was established. You can start debugging and perhaps understand better the code by changing it to "touch" the InputStream even if 1 byte is received...
Hope this helps.
Cheers!
EDIT: Just read the title again, I am not sure what you mean by saying you want to convert the code to Android? You only described your attempt to connect in iOS.
A quick Google search would give you the following links for Android guide:
1) Bluetooth (not BLE)
2) BLE
I'm working on a BLE proximity sensing feature based on Android and need some information.
Currently I see there are no BLE beacons manufacturers for android. I found 2 so far for iPhone.
1) http://www.estimote.com
2) http://www.gimbal.com
Estimote claims that their devices are generic but mainly they are publicized for iBeacons. So I'm not sure whether I should order them for a feature on Android.
Secondly gimbal explicitly mentions that their devices won't be enabled for android for proximity sensing.
So if any of you know where can I order BLE beacons compatible with Android please let me know.
Another thing, for prototype testing I was wondering whether I could use a Android BLE capable tablet or smartphone as a beacon to emit BLE signals?
Till now the documentation for android only suggests how to detect a beacon, But I'm not sure whether an Android device can be used as a beacon.
Any insights?
There is a BLE Beacon manufacturer for Android: Radius Networks
You can detect any standard iBeacon on Android using our Android iBeacon Library.
You can try it out yourself with our free iBeacon Locate app, which is based on this library. My company also sells both software and hardware iBeacons that I guarantee work with Android. But again, any standard iBeacon will work, too. Don't take my word for it -- just download our free app and use it to see one of our iBeacons. (We even have a free virtual machine you can use!)
It is currently not possible to make an iBeacon out of a stock Android device because the Bluetooth LE APIs, introduced in Android 4.3, do not support the peripheral mode needed to transmit advertisements like an iBeacon.
EDIT: It is now possible to make rooted Android 4.4.3 devices transmit as an iBeacon. See here.
I tried simple BLE scan app on Android, but the callback for LeDevices always returned null for UUID[]. Also, finding based on know UUID didnot work.
To add to David's reply. I have tried Radius Networks SDK, pretty clean. I like it.
Also, Estimotes has released their Android SDK today(1/7), which is good. The sample App shows notification, Distance, Major-Minor. I tested with 3 Estimotes & also with iPhone's app (making the iPhone as iBeacon). It works well, give it a try.
Note that you have to modify the code
change the ESTIMOTE_PROXIMITY_UUID value to the UUID that you are watching for.
Hope it helps.