[android-developers] Re: Accessing System Brightness

2009-06-05 Thread Hiro

This is indeed frustrating. however, there's a funny new
wrinkle whenever I use the new cupcake-approved sugar-free method,
the brightness stays after I go back to the home screen. (yay) I seem
to have problems when brightness gets too low though (IE, cant do
anything with the unit ... obviously). So do yourself a favor and put
a lower limit on it ;) I set mine to .1.



On May 28, 12:06 am, Mark android.eggenst...@googlemail.com wrote:
 It must still be possible in 1.5 cupcake:
 - PowerManager can set it
 - Settings - SoundDisplay - Brightness can change it
 - haven't checked Locale
 While the system setting might have privileged access to the API, the
 PowerManager is just a normal program. So how do they do it?
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[android-developers] Re: Accessing System Brightness

2009-05-28 Thread Mark

It must still be possible in 1.5 cupcake:
- PowerManager can set it
- Settings - SoundDisplay - Brightness can change it
- haven't checked Locale
While the system setting might have privileged access to the API, the
PowerManager is just a normal program. So how do they do it?

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[android-developers] Re: Accessing System Brightness

2009-04-28 Thread Raphael

On Thu, Apr 23, 2009 at 9:34 PM, coredump jose.jun...@gmail.com wrote:

 So I tried the 'correct' way to do it:

 Settings.System.putInt(getContentResolver(),
 Settings.System.SCREEN_BRIGHTNESS, 255);

 And it doesnt work. It seems to change the brightness value on the
 Display Settings Screen but not the actual display brightness. I tried
 with putString too, no game.

 I also tried to use the IHardware approach (described by joby some
 messages ago), but it seems to doesn't even exist on SDK 1.1 (at least
 eclipse could not resolve it).

It never existed on the SDK 1.1 as an official API, so the SDK won't
know about it.


 But there must be one way working because the Flashlight app on the
 Market does that perfectly. So, if anyone can provide a different
 approach I will be very thankful.

What SDK are you targetting?

For SDKs 1.0 and 1.1, the API was unfortunately there but not official
to make flashlights.

For SDK 1.5 there's a new *official* way to do a simple flashlight. No
hacks involved and you're guaranteed it will work. Dianne posted the 2
lines of code that you need earlier in the thread.

If you want a more complete example:
http://code.google.com/p/autosettings/source/browse/trunk/Flashlight/src/com/alfray/flashlight/FlashlightActivity.java

R/

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[android-developers] Re: Accessing System Brightness

2009-04-27 Thread coredump

So I tried the 'correct' way to do it:

Settings.System.putInt(getContentResolver(),
Settings.System.SCREEN_BRIGHTNESS, 255);

And it doesnt work. It seems to change the brightness value on the
Display Settings Screen but not the actual display brightness. I tried
with putString too, no game.

I also tried to use the IHardware approach (described by joby some
messages ago), but it seems to doesn't even exist on SDK 1.1 (at least
eclipse could not resolve it).

But there must be one way working because the Flashlight app on the
Market does that perfectly. So, if anyone can provide a different
approach I will be very thankful.

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[android-developers] Re: Accessing System Brightness

2009-04-24 Thread guruk

hmm but i also dont like that so much.

for example right now i was thinking to write a simple app just
changing the brightness
in a simple way. not just for a window, for the whole system.

Often I am out and just like a simple change brightness, without
searching through
the setup (imagine i am in the sun and already dont see anything) so
even 2 steps
are far away.

anyhow.. is there an intent how i can easily open the popup where i
can change the
system brightness?

thanks
chris


On Apr 16, 11:40 am, Dianne Hackborn hack...@android.com wrote:
         // Make the screen full bright for this activity.
         WindowManager.LayoutParams lp = getWindow().getAttributes();
         lp.screenBrightness = 1.0f;

         getWindow().setAttributes(lp);





 On Wed, Apr 15, 2009 at 10:21 PM, SR stan.r...@gmail.com wrote:

  Dianne,

  Would you mind sharing a snippet of code on how to do this in Cupcake
  using the new API?

  Thanks!

  Stan

  On Apr 8, 3:49 pm, Dianne Hackborn hack...@android.com wrote:
   There is a new API to be able to force the screen brightness while your
   window is on-screen.

   On Wed, Apr 8, 2009 at 12:08 PM, Todd Sjolander guyfantas...@gmail.com
  wrote:

 --
 Dianne Hackborn
 Android framework engineer
 hack...@android.com

 Note: please don't send private questions to me, as I don't have time to
 provide private support, and so won't reply to such e-mails.  All such
 questions should be posted on public forums, where I and others can see and
 answer them.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[android-developers] Re: Accessing System Brightness

2009-04-16 Thread Dianne Hackborn
// Make the screen full bright for this activity.
WindowManager.LayoutParams lp = getWindow().getAttributes();
lp.screenBrightness = 1.0f;

getWindow().setAttributes(lp);



On Wed, Apr 15, 2009 at 10:21 PM, SR stan.r...@gmail.com wrote:


 Dianne,

 Would you mind sharing a snippet of code on how to do this in Cupcake
 using the new API?

 Thanks!

 Stan

 On Apr 8, 3:49 pm, Dianne Hackborn hack...@android.com wrote:
  There is a new API to be able to force the screen brightness while your
  window is on-screen.
 
  On Wed, Apr 8, 2009 at 12:08 PM, Todd Sjolander guyfantas...@gmail.com
 wrote:
 
 



-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[android-developers] Re: Accessing System Brightness

2009-04-15 Thread SR

Dianne,

Would you mind sharing a snippet of code on how to do this in Cupcake
using the new API?

Thanks!

Stan

On Apr 8, 3:49 pm, Dianne Hackborn hack...@android.com wrote:
 There is a new API to be able to force the screen brightness while your
 window is on-screen.

 On Wed, Apr 8, 2009 at 12:08 PM, Todd Sjolander guyfantas...@gmail.comwrote:

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[android-developers] Re: Accessing System Brightness

2009-04-09 Thread Todd Sjolander

Ah, that makes sense.  Thank you.

On Apr 8, 4:45 pm, Dianne Hackborn hack...@android.com wrote:
 It will only modify the screen while that window/activity is being shown to
 the user.  This allows it to be done in a safe way (no permission required)
 which the system can recover from if there is a bug in the application (or
 if the application gets killed for some reason, as we tend to do).


 --
 Dianne Hackborn
 Android framework engineer
 hack...@android.com

 Note: please don't send private questions to me, as I don't have time to
 provide private support, and so won't reply to such e-mails.  All such
 questions should be posted on public forums, where I and others can see and
 answer them.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[android-developers] Re: Accessing System Brightness

2009-04-08 Thread Todd Sjolander

Dianne,

Is there a new way to do this in Cupcake, or is the functionality
being removed?

On Mar 23, 1:37 pm, Dianne Hackborn hack...@android.com wrote:
 This is a private API and will break in Cupcake.

 --
 Dianne Hackborn
 Android framework engineer
 hack...@android.com

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[android-developers] Re: Accessing System Brightness

2009-04-08 Thread Dianne Hackborn
There is a new API to be able to force the screen brightness while your
window is on-screen.

On Wed, Apr 8, 2009 at 12:08 PM, Todd Sjolander guyfantas...@gmail.comwrote:


 Dianne,

 Is there a new way to do this in Cupcake, or is the functionality
 being removed?

 On Mar 23, 1:37 pm, Dianne Hackborn hack...@android.com wrote:
  This is a private API and will break in Cupcake.
 
  --
  Dianne Hackborn
  Android framework engineer
  hack...@android.com

 



-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[android-developers] Re: Accessing System Brightness

2009-04-08 Thread Dianne Hackborn
It will only modify the screen while that window/activity is being shown to
the user.  This allows it to be done in a safe way (no permission required)
which the system can recover from if there is a bug in the application (or
if the application gets killed for some reason, as we tend to do).

On Wed, Apr 8, 2009 at 12:56 PM, Todd Sjolander guyfantas...@gmail.comwrote:


 Do you mean that the brightness changes will only affect a particular
 Activity or process, like a new xml tag for the activity or
 application tag?

 Also, thanks for the quick reply!

 On Apr 8, 3:49 pm, Dianne Hackborn hack...@android.com wrote:
  There is a new API to be able to force the screen brightness while your
  window is on-screen.
 
  On Wed, Apr 8, 2009 at 12:08 PM, Todd Sjolander guyfantas...@gmail.com
 wrote:
 
 
 
 
 
   Dianne,
 
   Is there a new way to do this in Cupcake, or is the functionality
   being removed?
 
   On Mar 23, 1:37 pm, Dianne Hackborn hack...@android.com wrote:
This is a private API and will break in Cupcake.
 
--
Dianne Hackborn
Android framework engineer
hack...@android.com
 
  --
  Dianne Hackborn
  Android framework engineer
  hack...@android.com
 
  Note: please don't send private questions to me, as I don't have time to
  provide private support, and so won't reply to such e-mails.  All such
  questions should be posted on public forums, where I and others can see
 and
  answer them.
 



-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[android-developers] Re: Accessing System Brightness

2009-03-23 Thread Dianne Hackborn
On Sun, Mar 22, 2009 at 10:45 PM, joby joby...@gmail.com wrote:

 IHardwareService hardware = IHardwareService.Stub.asInterface
 (
   ServiceManager.getService(hardware));

 try {
hardware.setScreenBacklight(150);
} catch (RemoteException e)
// TODO Auto-generated catch block
e.printStackTrace();
 }


This is a private API and will break in Cupcake.

-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support.  All such questions should be posted on public
forums, where I and others can see and answer them.

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[android-developers] Re: Accessing System Brightness

2009-03-22 Thread joby

i tried with  the below code but its not effecting

Settings.System.putInt(ftaContext.getContentResolver(),
Settings.System.SCREEN_BRIGHTNESS, bright);

but i got  the screen brightness by the below code

IHardwareService hardware = IHardwareService.Stub.asInterface
(   
  ServiceManager.getService(hardware));

try {
hardware.setScreenBacklight(150);
} catch (RemoteException e)
// TODO Auto-generated catch block
e.printStackTrace();
}
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[android-developers] Re: Accessing System Brightness

2009-03-21 Thread sm1

and to read it and log it:

int ib = Settings.System.getInt(getContentResolver(),
Settings.System.SCREEN_BRIGHTNESS,-1);
Log.d(SCREEN_BRIGHTNESS (0-255) {+ib+});


On Mar 20, 6:53 pm, mark.ka...@gmail.com wrote:
 int bright = 50;
 Settings.System.putInt(ftaContext.getContentResolver(),
 Settings.System.SCREEN_BRIGHTNESS, bright);

 On Mar 19, 9:14 pm, joby joby...@gmail.com wrote:

  Hi,

        I want to use the system brightness  in android,anybody can give
  me a sample code of getting the brightness from android.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[android-developers] Re: Accessing System Brightness

2009-03-21 Thread sm1

make that

Log.d(x...@#$% tag :-),SCREEN_BRIGHTNESS (0-255) {+ib+});

serge

On Mar 21, 10:40 am, sm1 sergemas...@gmail.com wrote:
 and to read it and log it:

     int ib = Settings.System.getInt(getContentResolver(),
         Settings.System.SCREEN_BRIGHTNESS,-1);
     Log.d(SCREEN_BRIGHTNESS (0-255) {+ib+});

 On Mar 20, 6:53 pm, mark.ka...@gmail.com wrote:

  int bright = 50;
  Settings.System.putInt(ftaContext.getContentResolver(),
  Settings.System.SCREEN_BRIGHTNESS, bright);

  On Mar 19, 9:14 pm, joby joby...@gmail.com wrote:

   Hi,

         I want to use the system brightness  in android,anybody can give
   me a sample code of getting the brightness from android.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[android-developers] Re: Accessing System Brightness

2009-03-20 Thread mark . kahrl

int bright = 50;
Settings.System.putInt(ftaContext.getContentResolver(),
Settings.System.SCREEN_BRIGHTNESS, bright);

On Mar 19, 9:14 pm, joby joby...@gmail.com wrote:
 Hi,

       I want to use the system brightness  in android,anybody can give
 me a sample code of getting the brightness from android.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---