Account Options

  1. Sign in
The old Google Groups will be going away soon.
Switch to the new Google Groups.
Google Groups Home
« Groups Home
Accessing System Brightness
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  18 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
joby  
View profile  
 More options Mar 20 2009, 12:14 am
From: joby <joby...@gmail.com>
Date: Thu, 19 Mar 2009 21:14:18 -0700 (PDT)
Local: Fri, Mar 20 2009 12:14 am
Subject: Accessing System Brightness
Hi,

      I want to use the system brightness  in android,anybody can give
me a sample code of getting the brightness from android.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
mark.ka...@gmail.com  
View profile  
 More options Mar 20 2009, 6:53 pm
From: mark.ka...@gmail.com
Date: Fri, 20 Mar 2009 15:53:20 -0700 (PDT)
Local: Fri, Mar 20 2009 6:53 pm
Subject: Re: Accessing System Brightness
int bright = 50;
Settings.System.putInt(ftaContext.getContentResolver(),
Settings.System.SCREEN_BRIGHTNESS, bright);

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


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
sm1  
View profile  
 More options Mar 21 2009, 10:40 am
From: sm1 <sergemas...@gmail.com>
Date: Sat, 21 Mar 2009 07:40:43 -0700 (PDT)
Local: Sat, Mar 21 2009 10:40 am
Subject: Re: Accessing System Brightness
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:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
sm1  
View profile  
 More options Mar 21 2009, 12:31 pm
From: sm1 <sergemas...@gmail.com>
Date: Sat, 21 Mar 2009 09:31:29 -0700 (PDT)
Local: Sat, Mar 21 2009 12:31 pm
Subject: Re: Accessing System Brightness
make that

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

serge

On Mar 21, 10:40 am, sm1 <sergemas...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
joby  
View profile  
 More options Mar 23 2009, 1:45 am
From: joby <joby...@gmail.com>
Date: Sun, 22 Mar 2009 22:45:59 -0700 (PDT)
Local: Mon, Mar 23 2009 1:45 am
Subject: Re: Accessing System Brightness
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 must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Dianne Hackborn  
View profile  
 More options Mar 23 2009, 1:37 pm
From: Dianne Hackborn <hack...@android.com>
Date: Mon, 23 Mar 2009 10:37:32 -0700
Local: Mon, Mar 23 2009 1:37 pm
Subject: Re: [android-developers] Re: Accessing System Brightness

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 must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Todd Sjolander  
View profile  
 More options Apr 8 2009, 3:08 pm
From: Todd Sjolander <GuyFantas...@gmail.com>
Date: Wed, 8 Apr 2009 12:08:52 -0700 (PDT)
Local: Wed, Apr 8 2009 3:08 pm
Subject: Re: Accessing System Brightness
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:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Dianne Hackborn  
View profile  
 More options Apr 8 2009, 3:49 pm
From: Dianne Hackborn <hack...@android.com>
Date: Wed, 8 Apr 2009 12:49:02 -0700
Local: Wed, Apr 8 2009 3:49 pm
Subject: Re: [android-developers] Re: Accessing System Brightness

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 must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Todd Sjolander  
View profile  
 More options Apr 8 2009, 3:56 pm
From: Todd Sjolander <GuyFantas...@gmail.com>
Date: Wed, 8 Apr 2009 12:56:30 -0700 (PDT)
Local: Wed, Apr 8 2009 3:56 pm
Subject: Re: Accessing System Brightness
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:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Dianne Hackborn  
View profile  
 More options Apr 8 2009, 4:45 pm
From: Dianne Hackborn <hack...@android.com>
Date: Wed, 8 Apr 2009 13:45:35 -0700
Local: Wed, Apr 8 2009 4:45 pm
Subject: Re: [android-developers] Re: Accessing System Brightness

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.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 must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Todd Sjolander  
View profile  
 More options Apr 9 2009, 8:11 am
From: Todd Sjolander <GuyFantas...@gmail.com>
Date: Thu, 9 Apr 2009 05:11:29 -0700 (PDT)
Local: Thurs, Apr 9 2009 8:11 am
Subject: Re: Accessing System Brightness
Ah, that makes sense.  Thank you.

On Apr 8, 4:45 pm, Dianne Hackborn <hack...@android.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
SR  
View profile  
 More options Apr 16 2009, 1:21 am
From: SR <Stan.R...@gmail.com>
Date: Wed, 15 Apr 2009 22:21:30 -0700 (PDT)
Local: Thurs, Apr 16 2009 1:21 am
Subject: Re: Accessing System Brightness
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:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Dianne Hackborn  
View profile  
 More options Apr 16 2009, 4:40 am
From: Dianne Hackborn <hack...@android.com>
Date: Thu, 16 Apr 2009 01:40:49 -0700
Local: Thurs, Apr 16 2009 4:40 am
Subject: Re: [android-developers] Re: Accessing System Brightness

        // Make the screen full bright for this activity.
        WindowManager.LayoutParams lp = getWindow().getAttributes();
        lp.screenBrightness = 1.0f;

        getWindow().setAttributes(lp);

--
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 must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
guruk  
View profile  
 More options Apr 24 2009, 3:00 pm
From: guruk <ilovesi...@gmail.com>
Date: Fri, 24 Apr 2009 12:00:33 -0700 (PDT)
Local: Fri, Apr 24 2009 3:00 pm
Subject: Re: Accessing System Brightness
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:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
coredump  
View profile  
 More options Apr 24 2009, 12:34 am
From: coredump <jose.jun...@gmail.com>
Date: Thu, 23 Apr 2009 21:34:50 -0700 (PDT)
Local: Fri, Apr 24 2009 12:34 am
Subject: Re: Accessing System Brightness
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 must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Raphael  
View profile  
 More options Apr 28 2009, 8:12 pm
From: Raphael <r...@android.com>
Date: Tue, 28 Apr 2009 17:12:16 -0700
Local: Tues, Apr 28 2009 8:12 pm
Subject: Re: [android-developers] Re: Accessing System Brightness

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/...

R/


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mark  
View profile  
 More options May 28 2009, 3:06 am
From: Mark <android.eggenst...@googlemail.com>
Date: Thu, 28 May 2009 00:06:40 -0700 (PDT)
Local: Thurs, May 28 2009 3:06 am
Subject: Re: Accessing System Brightness
It must still be possible in 1.5 cupcake:
- "PowerManager" can set it
- "Settings -> Sound&Display -> 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 must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Hiro  
View profile  
 More options Jun 5 2009, 8:00 pm
From: Hiro <the.h...@gmail.com>
Date: Fri, 5 Jun 2009 17:00:28 -0700 (PDT)
Local: Fri, Jun 5 2009 8:00 pm
Subject: Re: Accessing System Brightness
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:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »