Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Android
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
Android
Wake Lock Not Working in Android
Kishor Joshi
Ranch Hand
Posts: 674
posted 9 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Hi there
I have following code in my main Activity
private WakeLock lock; private Button button; @SuppressWarnings("deprecation") @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); //Set Power Manager PowerManager pm=(PowerManager)getSystemService(Context.POWER_SERVICE); //Initialize WakeLock lock=pm.newWakeLock(PowerManager.FULL_WAKE_LOCK, "MyLock"); button=(Button)findViewById(R.id.button1); button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub lock.release(); } });
When I run this code this is Not Working I mean Screen is Not Countinuosly on Brightness it dims as usual .
and FULL_WAKE_LOCK is also showing depreceated in eclipse.
What are the Other options to put this working WAKE_LOCK
Thanks
Ron McLeod
Marshal
Posts: 4488
572
I like...
posted 9 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Take a look
here
for information on how to tell the window manager to keep the device's screen turned on and bright for a particular Activity. Also, there is a code example
here
which might be helpful.
Consider Paul's
rocket mass heater
.
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
SharedPreference not working
How to create a toast via button click
Playing sounds effiecently.
How to control CheckBox status in preferences window?
Cannot find the problem in the code
More...