I want to change brightness of screen according to light..
I found links for getting brightness level and setting up brightness..
Change screen brightness onPause (Android app)
How to toggle auto brightness on and off? (not a repeat)
changing screen brightness programmatically in android
Changing screen brightness programmatically (as with the power widget)
But I want to change brightness as per surrounding light.. In short, I want to do same as auto brightness works..
How Can I detect surrounding light?? OR Can I trigger auto brightness functionality??
brightness is having value range between 0 to 255. I want to set brightness level according to surrounding light level which can not be 0 to 255. How can I get ratio between this two.
Help is needed. Thanks
Solution from myself:
I implemented shaking listener from here. I used aboce links also to make it completed.
I created ShakeBrightService.java
Fake for refreshing view
MainActivity1.java
FakeActivity is having theme
android:theme="@android:style/Theme.Translucent.NoTitleBar"
, so silently brightness is changed.