Udgivet den Skriv en kommentar

Android WakeLock + Cordova 3.*

Google Developer PowerManager

I Manifestet brug:

 <uses-permission android:name="android.permission.WAKE_LOCK" />

I activity*.java læg til det med tykt markeret. 

import android.os.Bundle;
import org.apache.cordova.*;
import android.view.WindowManager;
public class Tutix extends CordovaActivity
 {
 @Override
 public void onCreate(Bundle savedInstanceState)
 {
super.onCreate(savedInstanceState);
         getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
 // Set by <content src="index.html" /> in config.xml
 loadUrl(launchUrl);
 }
 }

Under layout:

android:keepScreenOn="true">

That’s it.

Skriv et svar