use the getString or the putString method instead and then convert to
a boolean or integer.  I am having a problem myself.  doing a
getstring of this property always returns "1" whether the blue tooth
is on or not.

Anybody else see this behavoir?  Anyone have a solution to finding out
if the bluetooth is powered on or not? Am I missing some permissions?
The only permission i am currently using is
android.permission.WRITE_SETTINGS. Below is my code...

String bluetoothEn = android.provider.Settings.System.getString
(getContentResolver(), android.provider.Settings.System.BLUETOOTH_ON);
boolean blueToothEn = (bluetoothEn.equals("1"));

On Jan 8, 10:42 pm, bendavis78 <bendavi...@gmail.com> wrote:
> Hi,  did you ever figure out how to do this?
>
> On Dec 1 2008, 8:18 pm, RM <rick.manc...@gmail.com> wrote:
>
> > Hi folks,
>
> > I'm writing an app that will, among other things, disable Bluetooth.
> > To do this, I've set the "android.permission.BLUETOOTH_ADMIN", and
> > inside an onClick() listener I'm using the following:
>
> >   Settings.System.putInt(getContentResolver(),
> > Settings.System.BLUETOOTH_ON, 0);
>
> > However, this does nothing on the actual phone.
>
> > Further, using the corresponding getInt() function to readback the
> > status crashes the app:
>
> >   Settings.System.getInt(PowerProfile.this.getContentResolver(),
> > Settings.System.BLUETOOTH_ON, btStatus);
>
> > Can someone guide me as to what is wrong, and/or what is the proper
> > way to enable/disable Bluetooth?
>
> > Many thanks,
> > RM

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to