views:

446

answers:

2

I want to write a program in J2ME to turn the Bluetooth on/off automaticly in a certain time without the user permission.

I'v been looking for a while but I couldn't find an answer.

+1  A: 

Some phones will automatically switch bluetooth ON when a MIDlet starts using the Java ME Bluetooth API.

Other phones will not.

AFAIK, there is no Java ME API to switch bluetooth ON/OFF.

I have yet to find a mobile phone that automatically switches bluetooth OFF after some time of inactivity.

Any way you find to do this (I'm sure it's doable in Symbian OS C++, for example) will be platform-dependant.

QuickRecipesOnSymbianOS
"I have yet to find a mobile phone that automatically switches bluetooth OFF after some time of inactivity."My HTC S750 does this
Sk93
HTC S750 = windows mobile 5.0? so maybe you can also do this with windows mobile native or C# programming...
QuickRecipesOnSymbianOS
thanx, i think all go for Symbian first then WM
Abdulaziz
A: 

There is definitely no way to programmatically switch your Bluetooth on and off in Java ME. However what may be useful is to switch between discoverable modes:

LocalDevice.getLocalDevice().setDiscoverable(DiscoveryAgent.GIAC);

to be discoverable, and

LocalDevice.getLocalDevice().setDiscoverable(DiscoveryAgent.NOT_DISCOVERABLE);

to hide from other devices. It doesn't save battery, but it does make things that little bit more secure I guess.

David Johnson
ty, but i think u can do it with MIDP 2.1 but really few mobile devices support it so i am going for Symbian atm then WM
Abdulaziz
OK, as far as I was aware there's nothing new in MIDP 2.1 that allows more Bluetooth functionality as it still uses JSR-82, which is an optional package, either way.Symbian is probably the best way to go - it gives much lower-level access to the hardware, although there's currently debates whether Symbian will still be worth supporting in the future since Nokia has publicly backed the new MeeGo OS and Symbian Ltd. was absorbed by Nokia.
David Johnson