views:

3009

answers:

5

Two question on Bluetooth development on Android:

  1. Is there a way to enable Bluetooth to be always on (I might have a long device discovery phase in my application) in Android? As far as I can see the default value is a count down from 120s.

  2. Does it exist any open source Bluetooth API implementations?

+1  A: 

Enabling Bluetooth to be always on, may not be a good decision, if your only concern is long discovery delay ("battery life"-wise).

As for third-party Bluetooth APIs, the only thing that I've heard of is iAnywhere Blue SDK (from Sybase, not free, only evaluation version available), which covers some of the features, that will be supported in the future from the system/bluetooth and bluez packages.

According to the Android's Bluetooth roadmap, most of the long waited things like Java API, Bluetooth 2.1 + EDR will be implemented, at one point in the future.

Good luck with your project.

Dimitar Dimitrov
Thanks for your battery advice, but at this stage in the project I do not care about the battery, only about constant Bluetooth :)
Dipper
+1  A: 

The Bluez stack on Linux is an open source implementation. It's also available on Windows but the API is much more complete on Linux.

When you say, 'enable Bluetooth to always be on' do you mean, always trying to discover other devices?

Most bluetooth chips have a deep sleep mode, where the chip is mostly down and just comes up a to check for activity on any established links. It will only wake up to full power when you want it to do something (discovery, make a connection) or there is activity on an existing link.

Yeah, it uses more battery power than if the Bluetooth were totally off but it's not a total vampire.

Pev
Yes, with always on I mean constant client discovery. The "problem" with android is the default 120s countdown. Is this changable? Lets say 600s?
Dipper
A: 

BlueCove is an open-source bluetooth implementation for Java.

It works on a lot of different machines and if correct there is a Android compatible version lurking around somewhere.

MrThys
+2  A: 

Bluetooth implementation is now available in the Android 2.0 API. See this and this.

Michaël
Yes, I saw the news too. Finally available :)
Dipper
Bluetooth is available in the SDK but the AVD doesn't support 2.0 API (level 5) or the doc isn't up-to-date : http://developer.android.com/guide/developing/tools/avd.html
Michaël
The overview link may be a better starting place than the other two links:http://developer.android.com/intl/zh-CN/guide/topics/wireless/bluetooth.html
RickNotFred
A: 

I wann how to enable the bluetooth in emulator

plz rpl me fst...

Pravin
As far as I know, the Android emulator does not support emulation of bluetooth yet
Dipper
What is "plz rpl me fst"? No time for vowels?
John Berryman