3

I would appreciate an example of BLE peripheral mode for Android-L.

The code that I have gives me strange errors (i.e too many advertisers) which makes no sense as there are no advertisers that i can see from scanner like Lightblue on ios.

geoaxis
  • 1,480
  • 6
  • 25
  • 46
  • http://developer.radiusnetworks.com/2014/07/06/making-an-ibeacon-with-android-l.html The author of this article will probably see this soon so I post it as a comment. – reTs Jul 08 '14 at 03:53
  • thanks, it seems that this code has some problems, for example AdvertiseCallback implementation is incorrect (it should have) two other methods. and I still get the same error on nexus 7. – geoaxis Jul 08 '14 at 10:35

3 Answers3

4

https://github.com/geoaxis/BluetoothTest works on my nexus 5 running L.

At first when initializing advertising I was getting: public static final int ADVERTISE_FAILED_CONTROLLER_FAILURE

Operation fails due to bluetooth controller failure.

Constant Value: 5 (0x00000005)

I was running other bluetooth apps, I killed all of them, restarted the bluetooth service and got a success. L is still preview, so some loose ends are expected.

geoaxis, thanks for forking, I wouldn't have had the chance to read this very clear sample otherwise; there should such a sample in the L dev preview samples.

cheers

FrancoisP
  • 51
  • 3
3

It seems that there is a bug for Android-L preview for Nexus 7. Nexus 5 works fine https://code.google.com/p/android-developer-preview/issues/detail?id=589

Example code for nexus 5 can be found here https://github.com/geoaxis/BluetoothTest

geoaxis
  • 1,480
  • 6
  • 25
  • 46
  • https://github.com/Hellomello13/BluetoothTest link is broken , where could we access this ? – nish1013 Aug 01 '14 at 14:37
  • fortunately I had cloned it https://github.com/geoaxis/BluetoothTest :) – geoaxis Aug 01 '14 at 14:59
  • Nexus 5 is not supported as ble peripheral mode in Android L, you can see the issue here https://code.google.com/p/android-developer-preview/issues/detail?id=1570#c52 – gonglong Jan 27 '15 at 07:36
  • 1
    yes, they changed this after release of Android 5.0/Nexus 5 (this was true in L preview). But you can test this code in Nexus 6/Android 5.0 – geoaxis Jan 27 '15 at 11:56
0

BLE peripheral mode for Android is expected in android version 4.5

Android
  • 82
  • 1
  • 10
  • Android-L preview will probably be version 4.5 (could be version 5.0(. I have this already working for Nexus5 now. – geoaxis Jul 10 '14 at 10:51
  • Dear! Can you show me the sample piece of code that you are using for advertising. – Android Jul 11 '14 at 07:00