QNimate

  • CoursesVideos
  • WP PremiumPlugins
  • DemosLab
  • Home
  • QIdea
  • QTrack
Home Carbon Ads Preventing Device From Sleeping Using Intel XDK

Preventing Device From Sleeping Using Intel XDK

This post is a part 7 of Intel XDK Complete Tutorial post series.

With just one line of code we can prevent device from sleeping. It doesn’t matter if the device is plugged in or not.

intel.xdk.device.managePower(true,false);

If you want to prevent the device from sleeping only if the device is plugged in then use this code

intel.xdk.device.managePower(true,true);

This function only works inside event handlers. So you can’t just call it whenever you like to. For example:

document.addEventListener("intel.xdk.device.ready",function(){
           intel.xdk.device.managePower(true,true);
},false);

Make sure you have also added Intel XDK Device plugin in your app.

If you press the power button in that case it will go to sleep.

Nov 5, 2014Narayan Prusty
Sending SMS using Intel XDKFind Internet Connection Type Using Intel XDK

Leave a Reply Cancel reply

To create code blocks or other preformatted text, indent by four spaces:

    This will be displayed in a monospaced font. The first four
    spaces will be stripped off, but all other whitespace
    will be preserved.
    
    Markdown is turned off in code blocks:
     [This is not a link](http://example.com)

To create not a block, but an inline code span, use backticks:

Here is some inline `code`.

For more help see http://daringfireball.net/projects/markdown/syntax

Narayan Prusty

I am a software engineer specialising in Blockchain, DevOps and Go/JavaScript. This is my personal blog where I write about things that I learn and feel interesting to share.

7 years ago Cordova
Share this
0
GooglePlus
0
Facebook
0
Twitter
0
Linkedin
Related Articles
  • Intel XDK Copy to Clipboard
  • Launch Default Browser using Intel XDK
  • Launch Browser Inside Intel XDK App
  • Sending SMS using Intel XDK
  • Vibrating Phone using Intel XDK
Our Sponsor
My Books

2014 - 2015 © QNimate
All tutorials MIT license