package com.hughisaacs2.cordova.plugins.androidscreensaverplugin;

import android.annotation.TargetApi;
import android.service.dreams.DreamService;
import android.webkit.WebView;
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
	//WebView webView = new WebView(this);
        //setContentView(webView);
        //webView.loadUrl("file:///android_asset/www/screensaver.html");
		cwv webview = new CordovaWebView(this);
		org.apache.cordova.Config.init(this);
        setContentView(cwv);
        cwv.loadUrl(Config.getStartUrl());
    }
}

@@ -177,16 +177,230 @@
 bView;%0D%0A
+import org.apache.cordova.CallbackContext;%0D%0Aimport org.apache.cordova.CordovaArgs;%0D%0Aimport org.apache.cordova.CordovaInterface;%0D%0Aimport org.apache.cordova.CordovaPlugin;%0D%0Aimport org.apache.cordova.CordovaWebView;%0D%0A
 import o
@@ -493,16 +493,44 @@
 Service 
+implements CordovaInterface 
 %7B%0D%0A     
@@ -798,46 +798,8 @@
 t%0D%0A%09
-//WebView webView = new WebView(this);
 %0D%0A  
@@ -804,18 +804,16 @@
         
-//
 setConte
@@ -823,203 +823,209 @@
 iew(
-webView);%0D%0A        //webView.loadUrl(%22file:///android_asset/www/
+R.layout.cordova_
 screen
+_
 saver
-.html%22);%0D%0A%09%09cwv webview = new CordovaWebView(this);%0D%0A%09%09org.apache.cordova.Config.init(this);%0D%0A        setContentView(cwv
+);%0D%0A        cwv = (CordovaWebView) findViewById(R.id.CordovaScreenSaverWebView);%0D%0A%0D%0A        String screenSaverIndex = preferences.getString(%22ScreenSaverIndex%22, %22index.html%22
 );%0D%0A
@@ -1048,28 +1048,24 @@
 Url(
-Config.getStartUrl()
+screenSaverIndex
 );%0D%0A

Update ScreensaverProvider.java