package com.hughisaacs2.cordova.plugins.androidscreensaverplugin;

import android.annotation.TargetApi;
import android.content.Intent;
import android.service.dreams.DreamService;
import android.view.View;
import android.webkit.WebChromeClient;
import android.webkit.WebView;

import android.app.ActivityManager;
import android.os.Build;
import android.graphics.Color;
import android.content.Context;

import org.apache.cordova.CallbackContext;
import org.apache.cordova.CordovaArgs;
import org.apache.cordova.CordovaInterface;
import org.apache.cordova.CordovaPlugin;
import org.apache.cordova.CordovaWebView;
import org.apache.cordova.*;

@TargetApi(17)
public class ScreensaverProvider extends DreamService {
     @Override
     CordovaWebView cwv;
    public void onAttachedToWindow() {
        super.onAttachedToWindow();
        // Allow user touch
        setInteractive(true);
        // Hide system UI
        setFullscreen(true);
        // Set the dream layout

        cwv webview = new CordovaWebView(this);
        /*
        WebView webView = new WebView(this);
        setContentView(webView);
        webView.getSettings().setJavaScriptEnabled(true);
        webView.getSettings().setGeolocationEnabled(true);
        webView.getSettings().setDomStorageEnabled(true);
        webView.getSettings().setAllowFileAccess(true);

        webView.loadUrl(screenSaverIndex);
*/
        //setContentView(R.layout.cordova_screen_saver);
        //cwv = (CordovaWebView) findViewById(R.id.CordovaScreenSaverWebView);
        String screenSaverIndex = preferences.getString("ScreenSaverIndex", "index.html");
        cwv.loadUrl("file:///android_asset/www/screensaver.html");
    }
}

@@ -625,38 +625,8 @@
 ew;%0D
-%0Aimport org.apache.cordova.*;%0D
 %0A%0D%0A@
@@ -972,69 +972,8 @@
 %0D%0A%0D%0A
-        cwv webview = new CordovaWebView(this);%0D%0A        /*%0D%0A
     
@@ -1281,24 +1281,24 @@
 s(true);%0D%0A%0D%0A
+
         webV
@@ -1313,282 +1313,8 @@
 Url(
-screenSaverIndex);%0D%0A*/%0D%0A        //setContentView(R.layout.cordova_screen_saver);%0D%0A        //cwv = (CordovaWebView) findViewById(R.id.CordovaScreenSaverWebView);%0D%0A        String screenSaverIndex = preferences.getString(%22ScreenSaverIndex%22, %22index.html%22);%0D%0A        cwv.loadUrl(
 %22fil

Update ScreensaverProvider.java