Example usage for android.webkit WebSettings setGeolocationEnabled

List of usage examples for android.webkit WebSettings setGeolocationEnabled

Introduction

In this page you can find the example usage for android.webkit WebSettings setGeolocationEnabled.

Prototype

public abstract void setGeolocationEnabled(boolean flag);

Source Link

Document

Sets whether Geolocation is enabled.

Usage

From source file:net.evecom.android.web.Web5Activity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mContext = this;
    temp = HttpUtil.getPageSize(this);
    setContentView(R.layout.message_post_web);
    imageView = (ImageView) findViewById(R.id.image_view_at_web);
    webView = (WebView) this.findViewById(R.id.wv_oauth_message);
    CookieSyncManager.createInstance(this);
    CookieSyncManager.getInstance().startSync();
    CookieManager.getInstance().removeSessionCookie();
    /**/* www.  j av  a  2s  .  c  o  m*/
     * WebViewJavaScript
     */
    webView.getSettings().setJavaScriptEnabled(true);

    /**
     * loadUrl()
     */
    webView.setWebViewClient(new HelloWebViewClient());
    dialog = ProgressDialog.show(Web5Activity.this, null, "..");
    dialog.setCancelable(true);
    // http://harlan-pc/fzaj/emergency/mobileWebApp/publicInfo/login.do?userName=zf1&userPwd=1
    // webView.loadUrl("http://www.baidu.com");
    // String url = HttpUtil.BASE_PC_URL
    // + "/buildingController/login"; http://harlan-pc/gssms/mobile/
    // String url =HttpUtil.BASE_PC_URL+"/loginController/countLogin";
    String url = HttpUtil.BASE_PC_URL + "mobile/loginController/countLogin";
    // post
    // String postDate = "loginname=sysadmin&pwd=888888";
    String postDate = "loginname=" + ShareUtil.getString(getApplicationContext(), "SESSION", "USERNAME", "")
            + "&pwd=" + ShareUtil.getString(getApplicationContext(), "SESSION", "PASSWORD", "") + "&pageSize="
            + temp;
    // EncodingUtils.getBytes(data, charset)
    webView.postUrl(url, EncodingUtils.getBytes(postDate, "BASE64"));
    // 
    webView.setDownloadListener(new MyWebViewDownLoadListener());
    WebSettings webSettings = webView.getSettings();
    webSettings.setSupportZoom(true);
    webSettings.setJavaScriptEnabled(true);
    webSettings.setJavaScriptCanOpenWindowsAutomatically(true);
    webSettings.setBuiltInZoomControls(true);// support zoom
    // webSettings.setPluginsEnabled(true);//support flash
    webSettings.setUseWideViewPort(true);
    webSettings.setLoadWithOverviewMode(true);
    // webSettings.setPluginsEnabled(true); //(flash)

    /**  */
    // //
    webSettings.setDatabaseEnabled(true);
    String dir = this.getApplicationContext().getDir("database", Context.MODE_PRIVATE).getPath();
    // 
    webSettings.setGeolocationEnabled(true);
    // 
    webSettings.setGeolocationDatabasePath(dir);
    // 
    webSettings.setDomStorageEnabled(true);

    DisplayMetrics metrics = new DisplayMetrics();
    getWindowManager().getDefaultDisplay().getMetrics(metrics);
    int mDensity = metrics.densityDpi;
    // DebugLog.d(TAG, "densityDpi = " + mDensity);
    if (mDensity == 240) {
        webSettings.setDefaultZoom(ZoomDensity.FAR);
    } else if (mDensity == 160) {
        webSettings.setDefaultZoom(ZoomDensity.MEDIUM);
    } else if (mDensity == 120) {
        webSettings.setDefaultZoom(ZoomDensity.CLOSE);
        // }else if(mDensity == DisplayMetrics..DENSITY_XHIGH){
        // webSettings.setDefaultZoom(ZoomDensity.FAR);
    } else if (mDensity == DisplayMetrics.DENSITY_HIGH) {
        webSettings.setDefaultZoom(ZoomDensity.FAR);
    }
    webView.setWebChromeClient(m_chromeClient);// (flash)

    dialogPress = new AlertDialog.Builder(this).setTitle("").setMessage(":0/0")
            .setPositiveButton("", new OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    dialog.dismiss();
                }
            }).create();
}

From source file:net.evecom.android.web.Web4Activity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mContext = this;
    temp = HttpUtil.getPageSize(this);
    setContentView(R.layout.message_post_web);
    imageView = (ImageView) findViewById(R.id.image_view_at_web);
    webView = (WebView) this.findViewById(R.id.wv_oauth_message);
    CookieSyncManager.createInstance(this);
    CookieSyncManager.getInstance().startSync();
    CookieManager.getInstance().removeSessionCookie();
    /**/*www  .  ja  v  a2s  . com*/
     * WebViewJavaScript
     */
    webView.getSettings().setJavaScriptEnabled(true);

    /**
     * loadUrl()
     */
    webView.setWebViewClient(new HelloWebViewClient());
    dialog = ProgressDialog.show(Web4Activity.this, null, "..");
    dialog.setCancelable(true);
    // http://harlan-pc/fzaj/emergency/mobileWebApp/publicInfo/login.do?userName=zf1&userPwd=1
    // webView.loadUrl("http://www.baidu.com");
    // String url = HttpUtil.BASE_PC_URL
    // + "/buildingController/login"; http://harlan-pc/gssms/mobile/
    // String url
    // =HttpUtil.BASE_PC_URL+"loginController/professionalJobLogin";
    String url = HttpUtil.BASE_PC_URL + "mobile/loginController/professionalJobLogin";
    // post
    // String postDate = "loginname=sysadmin&pwd=888888";
    String postDate = "loginname=" + ShareUtil.getString(getApplicationContext(), "SESSION", "USERNAME", "")
            + "&pwd=" + ShareUtil.getString(getApplicationContext(), "SESSION", "PASSWORD", "") + "&pageSize="
            + temp;
    // webView.postUrl(url, postData) postDatabyte[] 
    // EncodingUtils.getBytes(data, charset)
    webView.postUrl(url, EncodingUtils.getBytes(postDate, "BASE64"));
    // 
    webView.setDownloadListener(new MyWebViewDownLoadListener());
    WebSettings webSettings = webView.getSettings();
    webSettings.setSupportZoom(true);
    webSettings.setJavaScriptEnabled(true);
    webSettings.setJavaScriptCanOpenWindowsAutomatically(true);
    webSettings.setBuiltInZoomControls(true);// support zoom
    // webSettings.setPluginsEnabled(true);//support flash
    webSettings.setUseWideViewPort(true);
    webSettings.setLoadWithOverviewMode(true);
    // webSettings.setPluginsEnabled(true); //(flash)

    /**  */
    // //
    webSettings.setDatabaseEnabled(true);
    String dir = this.getApplicationContext().getDir("database", Context.MODE_PRIVATE).getPath();
    // 
    webSettings.setGeolocationEnabled(true);
    // 
    webSettings.setGeolocationDatabasePath(dir);
    // 
    webSettings.setDomStorageEnabled(true);

    DisplayMetrics metrics = new DisplayMetrics();
    getWindowManager().getDefaultDisplay().getMetrics(metrics);
    int mDensity = metrics.densityDpi;
    // DebugLog.d(TAG, "densityDpi = " + mDensity);
    if (mDensity == 240) {
        webSettings.setDefaultZoom(ZoomDensity.FAR);
    } else if (mDensity == 160) {
        webSettings.setDefaultZoom(ZoomDensity.MEDIUM);
    } else if (mDensity == 120) {
        webSettings.setDefaultZoom(ZoomDensity.CLOSE);
        // }else if(mDensity == DisplayMetrics..DENSITY_XHIGH){
        // webSettings.setDefaultZoom(ZoomDensity.FAR);
    } else if (mDensity == DisplayMetrics.DENSITY_HIGH) {
        webSettings.setDefaultZoom(ZoomDensity.FAR);
    }
    webView.setWebChromeClient(m_chromeClient);// (flash)

    dialogPress = new AlertDialog.Builder(this).setTitle("").setMessage(":0/0")
            .setPositiveButton("", new OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    dialog.dismiss();
                }
            }).create();
}

From source file:net.evecom.android.web.Web3Activity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mContext = this;
    temp = HttpUtil.getPageSize(this);
    setContentView(R.layout.message_post_web);
    imageView = (ImageView) findViewById(R.id.image_view_at_web);
    webView = (WebView) this.findViewById(R.id.wv_oauth_message);
    CookieSyncManager.createInstance(this);
    CookieSyncManager.getInstance().startSync();
    CookieManager.getInstance().removeSessionCookie();
    /**//from ww w  .  j av a  2 s  .c om
     * WebViewJavaScript
     */
    webView.getSettings().setJavaScriptEnabled(true);

    /**
     * loadUrl()
     */
    webView.setWebViewClient(new HelloWebViewClient());
    dialog = ProgressDialog.show(Web3Activity.this, null, "..");
    dialog.setCancelable(true);
    // http://harlan-pc/fzaj/emergency/mobileWebApp/publicInfo/login.do?userName=zf1&userPwd=1
    // http://localhost/gssms/mobile/base/loginController/login?loginname=sysadmin&pwd=888888
    // String url = HttpUtil.BASE_PC_URL
    // + "/base/loginController/login";
    // http://localhost/gssms/mobile/loginController/baseLogin?loginname=sysadmin&pwd=888888
    String url = HttpUtil.BASE_PC_URL + "mobile/loginController/baseLogin";
    // post
    // String postDate = "loginname=sysadmin&pwd=888888";
    String postDate = "loginname=" + ShareUtil.getString(getApplicationContext(), "SESSION", "USERNAME", "")
            + "&pwd=" + ShareUtil.getString(getApplicationContext(), "SESSION", "PASSWORD", "") + "&pageSize="
            + temp;
    // webView.postUrl(url, postData) postDatabyte[] 
    // EncodingUtils.getBytes(data, charset)
    webView.postUrl(url, EncodingUtils.getBytes(postDate, "BASE64"));
    // 
    webView.setDownloadListener(new MyWebViewDownLoadListener());
    WebSettings webSettings = webView.getSettings();
    webSettings.setSupportZoom(true);
    webSettings.setJavaScriptEnabled(true);
    webSettings.setJavaScriptCanOpenWindowsAutomatically(true);
    webSettings.setBuiltInZoomControls(true);// support zoom
    // webSettings.setPluginsEnabled(true);//support flash
    webSettings.setUseWideViewPort(true);
    webSettings.setLoadWithOverviewMode(true);
    // webSettings.setPluginsEnabled(true); //(flash)

    /**  */
    // //
    webSettings.setDatabaseEnabled(true);
    String dir = this.getApplicationContext().getDir("database", Context.MODE_PRIVATE).getPath();
    // 
    webSettings.setGeolocationEnabled(true);
    // 
    webSettings.setGeolocationDatabasePath(dir);
    // 
    webSettings.setDomStorageEnabled(true);

    DisplayMetrics metrics = new DisplayMetrics();
    getWindowManager().getDefaultDisplay().getMetrics(metrics);
    int mDensity = metrics.densityDpi;
    // DebugLog.d(TAG, "densityDpi = " + mDensity);
    if (mDensity == 240) {
        webSettings.setDefaultZoom(ZoomDensity.FAR);
    } else if (mDensity == 160) {
        webSettings.setDefaultZoom(ZoomDensity.MEDIUM);
    } else if (mDensity == 120) {
        webSettings.setDefaultZoom(ZoomDensity.CLOSE);
        // }else if(mDensity == DisplayMetrics..DENSITY_XHIGH){
        // webSettings.setDefaultZoom(ZoomDensity.FAR);
    } else if (mDensity == DisplayMetrics.DENSITY_HIGH) {
        webSettings.setDefaultZoom(ZoomDensity.FAR);
    }
    webView.setWebChromeClient(m_chromeClient);// (flash)

    dialogPress = new AlertDialog.Builder(this).setTitle("").setMessage(":0/0")
            .setPositiveButton("", new OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    dialog.dismiss();
                }
            }).create();
}

From source file:net.evecom.android.web.Web2Activity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mContext = this;
    temp = HttpUtil.getPageSize(this);
    setContentView(R.layout.message_post_web);
    imageView = (ImageView) findViewById(R.id.image_view_at_web);
    webView = (WebView) this.findViewById(R.id.wv_oauth_message);
    CookieSyncManager.createInstance(this);
    CookieSyncManager.getInstance().startSync();
    CookieManager.getInstance().removeSessionCookie();
    /**/*from w  w  w.j  a  va2s. co m*/
     * WebViewJavaScript
     */
    webView.getSettings().setJavaScriptEnabled(true);

    /**
     * loadUrl()
     */
    webView.setWebViewClient(new HelloWebViewClient());
    dialog = ProgressDialog.show(Web2Activity.this, null, "..");
    dialog.setCancelable(true);
    // http://localhost/gssms/mobile/loginController/dailyOfficeLogin?loginname=sysadmin&pwd=888888
    String url = HttpUtil.BASE_PC_URL + "mobile/loginController/dailyOfficeLogin";
    // post
    // String postDate = "loginname=sysadmin&pwd=888888";
    String postDate = "loginname=" + ShareUtil.getString(getApplicationContext(), "SESSION", "USERNAME", "")
            + "&pwd=" + ShareUtil.getString(getApplicationContext(), "SESSION", "PASSWORD", "") + "&pageSize="
            + temp;
    // webView.postUrl(url, postData) postDatabyte[] 
    // EncodingUtils.getBytes(data, charset)
    webView.postUrl(url, EncodingUtils.getBytes(postDate, "BASE64"));
    // 
    webView.setDownloadListener(new MyWebViewDownLoadListener());
    WebSettings webSettings = webView.getSettings();
    webSettings.setSupportZoom(true);
    webSettings.setJavaScriptEnabled(true);
    webSettings.setJavaScriptCanOpenWindowsAutomatically(true);
    webSettings.setBuiltInZoomControls(true);// support zoom
    // webSettings.setPluginsEnabled(true);//support flash
    webSettings.setUseWideViewPort(true);
    webSettings.setLoadWithOverviewMode(true);
    // webSettings.setPluginsEnabled(true); //(flash)
    /**  */
    // //
    webSettings.setDatabaseEnabled(true);
    String dir = this.getApplicationContext().getDir("database", Context.MODE_PRIVATE).getPath();
    // 
    webSettings.setGeolocationEnabled(true);
    // 
    webSettings.setGeolocationDatabasePath(dir);
    // 
    webSettings.setDomStorageEnabled(true);

    DisplayMetrics metrics = new DisplayMetrics();
    getWindowManager().getDefaultDisplay().getMetrics(metrics);
    int mDensity = metrics.densityDpi;
    // DebugLog.d(TAG, "densityDpi = " + mDensity);
    if (mDensity == 240) {
        webSettings.setDefaultZoom(ZoomDensity.FAR);
    } else if (mDensity == 160) {
        webSettings.setDefaultZoom(ZoomDensity.MEDIUM);
    } else if (mDensity == 120) {
        webSettings.setDefaultZoom(ZoomDensity.CLOSE);
        // }else if(mDensity == DisplayMetrics..DENSITY_XHIGH){
        // webSettings.setDefaultZoom(ZoomDensity.FAR);
    } else if (mDensity == DisplayMetrics.DENSITY_HIGH) {
        webSettings.setDefaultZoom(ZoomDensity.FAR);
    }
    webView.setWebChromeClient(m_chromeClient);// (flash)

    dialogPress = new AlertDialog.Builder(this).setTitle("").setMessage(":0/0")
            .setPositiveButton("", new OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    dialog.dismiss();
                }
            }).create();
}

From source file:net.evecom.android.web.WebdbActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mContext = this;
    temp = HttpUtil.getPageSize(this);
    setContentView(R.layout.message_post_web);
    imageView = (ImageView) findViewById(R.id.image_view_at_web);
    webView = (WebView) this.findViewById(R.id.wv_oauth_message);
    CookieSyncManager.createInstance(this);
    CookieSyncManager.getInstance().startSync();
    CookieManager.getInstance().removeSessionCookie();
    /**// w w w .  jav  a2  s .c  o m
     * WebViewJavaScript
     */
    webView.getSettings().setJavaScriptEnabled(true);
    /**
     * loadUrl()
     */
    HelloWebViewClient client = new HelloWebViewClient();
    webView.setWebViewClient(client);
    dialog = ProgressDialog.show(WebdbActivity.this, null, "..");
    dialog.setCancelable(true);
    // http://harlan-pc/fzaj/emergency/mobileWebApp/publicInfo/login.do?userName=zf1&userPwd=1
    // webView.loadUrl("http://www.baidu.com");
    // String url = HttpUtil.BASE_PC_URL
    // String url =HttpUtil.BASE_PC_URL+"loginController/messageLogin";
    String url = HttpUtil.BASE_PC_URL + "mobile/loginController/eventlistLogin";
    // post
    // http://wangzy:8081/gssms/mobile/loginController/eventlistLogin?loginname=sysadmin&pwd=888888
    // String postDate = "loginname=sysadmin&pwd=888888";
    String postDate = "loginname=" + ShareUtil.getString(getApplicationContext(), "SESSION", "USERNAME", "")
            + "&pwd=" + ShareUtil.getString(getApplicationContext(), "SESSION", "PASSWORD", "") + "&pageSize="
            + temp;
    // webView.postUrl(url, postData) postDatabyte[] 
    // EncodingUtils.getBytes(data, charset)
    webView.postUrl(url, EncodingUtils.getBytes(postDate, "BASE64"));
    // 
    webView.setDownloadListener(new MyWebViewDownLoadListener());
    WebSettings webSettings = webView.getSettings();
    webSettings.setSupportZoom(true);
    webSettings.setJavaScriptEnabled(true);
    webSettings.setJavaScriptCanOpenWindowsAutomatically(true);
    webSettings.setBuiltInZoomControls(true);// support zoom
    // webSettings.setPluginsEnabled(true);//support flash
    webSettings.setUseWideViewPort(true);
    webSettings.setLoadWithOverviewMode(true);
    // webSettings.setPluginsEnabled(true); //(flash)

    /**  */
    // //
    webSettings.setDatabaseEnabled(true);
    String dir = this.getApplicationContext().getDir("database", Context.MODE_PRIVATE).getPath();
    // 
    webSettings.setGeolocationEnabled(true);
    // 
    webSettings.setGeolocationDatabasePath(dir);
    // 
    webSettings.setDomStorageEnabled(true);

    DisplayMetrics metrics = new DisplayMetrics();
    getWindowManager().getDefaultDisplay().getMetrics(metrics);
    int mDensity = metrics.densityDpi;
    // DebugLog.d(TAG, "densityDpi = " + mDensity);
    if (mDensity == 240) {
        webSettings.setDefaultZoom(ZoomDensity.FAR);
    } else if (mDensity == 160) {
        webSettings.setDefaultZoom(ZoomDensity.MEDIUM);
    } else if (mDensity == 120) {
        webSettings.setDefaultZoom(ZoomDensity.CLOSE);
        // }else if(mDensity == DisplayMetrics..DENSITY_XHIGH){
        // webSettings.setDefaultZoom(ZoomDensity.FAR);
    } else if (mDensity == DisplayMetrics.DENSITY_HIGH) {
        webSettings.setDefaultZoom(ZoomDensity.FAR);
    }
    webView.setWebChromeClient(m_chromeClient);// (flash)
    dialogPress = new AlertDialog.Builder(this).setTitle("").setMessage(":0/0")
            .setPositiveButton("", new OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    dialog.dismiss();
                }
            }).create();
}

From source file:com.example.administrator.mywebviewdrawsign.SysWebView.java

/**
 * Initialize webview./*from  w w w.  j a  v a  2  s .  c o m*/
 */
@SuppressLint({ "NewApi", "SetJavaScriptEnabled" })
private void setup() {
    this.setInitialScale(0);
    this.setVerticalScrollBarEnabled(true);
    this.setHorizontalScrollBarEnabled(true);
    this.requestFocusFromTouch();
    // Enable JavaScript
    WebSettings settings = this.getSettings();

    settings.setBuiltInZoomControls(false);// ??
    settings.setUseWideViewPort(false);
    settings.setLoadWithOverviewMode(true);
    settings.setJavaScriptEnabled(true);
    settings.setJavaScriptCanOpenWindowsAutomatically(true);
    settings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.NORMAL);
    settings.setAllowFileAccess(true);
    settings.setAppCacheMaxSize(1024 * 1024 * 32);
    settings.setAppCachePath(mContext.getFilesDir().getPath() + "/cache");
    settings.setAppCacheEnabled(true);
    settings.setCacheMode(WebSettings.LOAD_DEFAULT);
    // Set Cache Mode: LOAD_NO_CACHE is noly for debug
    //settings.setCacheMode(WebSettings.LOAD_NO_CACHE);
    //enablePageCache(settings,5);
    //enableWorkers(settings);

    // Enable database
    settings.setDatabaseEnabled(true);
    String databasePath = mContext.getApplicationContext().getDir("database", Context.MODE_PRIVATE).getPath();
    settings.setDatabasePath(databasePath);

    // Enable DOM storage
    settings.setDomStorageEnabled(true);

    // Enable built-in geolocation
    settings.setGeolocationEnabled(true);

    // Improve render performance
    settings.setRenderPriority(WebSettings.RenderPriority.HIGH);

    if (Build.VERSION.SDK_INT >= 21) {
        settings.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
    }
}

From source file:org.apache.cordova.CordovaWebView.java

/**
 * Initialize webview.// w  w w .jav a 2s.c o m
 */
@SuppressWarnings("deprecation")
@SuppressLint("NewApi")
private void setup() {

    this.setInitialScale(0);
    this.setVerticalScrollBarEnabled(false);
    this.requestFocusFromTouch();

    // Enable JavaScript
    WebSettings settings = this.getSettings();
    settings.setJavaScriptEnabled(true);
    settings.setJavaScriptCanOpenWindowsAutomatically(true);
    settings.setLayoutAlgorithm(LayoutAlgorithm.NORMAL);

    //Set the nav dump for HTC 2.x devices (disabling for ICS/Jellybean)
    if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.HONEYCOMB)
        settings.setNavDump(true);

    //Jellybean rightfully tried to lock this down. Too bad they didn't give us a whitelist
    //while we do this
    if (android.os.Build.VERSION.SDK_INT > android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1)
        settings.setAllowUniversalAccessFromFileURLs(true);
    // Enable database
    settings.setDatabaseEnabled(true);
    String databasePath = this.cordova.getActivity().getApplicationContext()
            .getDir("database", Context.MODE_PRIVATE).getPath();
    settings.setDatabasePath(databasePath);

    // Enable DOM storage
    settings.setDomStorageEnabled(true);

    // Enable built-in geolocation
    settings.setGeolocationEnabled(true);

    //Start up the plugin manager
    try {
        this.pluginManager = new PluginManager(this, this.cordova);
    } catch (Exception e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    exposeJsInterface();
}

From source file:org.apache.cordova.AndroidWebView.java

/**
 * Initialize webview.//  w  w  w  . j a v a  2  s  .com
 */
@SuppressWarnings("deprecation")
@SuppressLint("NewApi")
private void setup() {
    this.setInitialScale(0);
    this.setVerticalScrollBarEnabled(false);
    if (shouldRequestFocusOnInit()) {
        this.requestFocusFromTouch();
    }
    // Enable JavaScript
    WebSettings settings = this.getSettings();
    settings.setJavaScriptEnabled(true);
    settings.setJavaScriptCanOpenWindowsAutomatically(true);
    settings.setLayoutAlgorithm(LayoutAlgorithm.NORMAL);

    // Set the nav dump for HTC 2.x devices (disabling for ICS, deprecated entirely for Jellybean 4.2)
    try {
        Method gingerbread_getMethod = WebSettings.class.getMethod("setNavDump", new Class[] { boolean.class });

        String manufacturer = android.os.Build.MANUFACTURER;
        Log.d(TAG, "CordovaWebView is running on device made by: " + manufacturer);
        if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.HONEYCOMB
                && android.os.Build.MANUFACTURER.contains("HTC")) {
            gingerbread_getMethod.invoke(settings, true);
        }
    } catch (NoSuchMethodException e) {
        Log.d(TAG, "We are on a modern version of Android, we will deprecate HTC 2.3 devices in 2.8");
    } catch (IllegalArgumentException e) {
        Log.d(TAG, "Doing the NavDump failed with bad arguments");
    } catch (IllegalAccessException e) {
        Log.d(TAG, "This should never happen: IllegalAccessException means this isn't Android anymore");
    } catch (InvocationTargetException e) {
        Log.d(TAG, "This should never happen: InvocationTargetException means this isn't Android anymore.");
    }

    //We don't save any form data in the application
    settings.setSaveFormData(false);
    settings.setSavePassword(false);

    // Jellybean rightfully tried to lock this down. Too bad they didn't give us a whitelist
    // while we do this
    if (android.os.Build.VERSION.SDK_INT > android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1)
        Level16Apis.enableUniversalAccess(settings);
    // Enable database
    // We keep this disabled because we use or shim to get around DOM_EXCEPTION_ERROR_16
    String databasePath = this.cordova.getActivity().getApplicationContext()
            .getDir("database", Context.MODE_PRIVATE).getPath();
    settings.setDatabaseEnabled(true);
    settings.setDatabasePath(databasePath);

    //Determine whether we're in debug or release mode, and turn on Debugging!
    try {
        final String packageName = this.cordova.getActivity().getPackageName();
        final PackageManager pm = this.cordova.getActivity().getPackageManager();
        ApplicationInfo appInfo;

        appInfo = pm.getApplicationInfo(packageName, PackageManager.GET_META_DATA);

        if ((appInfo.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0
                && android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT) {
            setWebContentsDebuggingEnabled(true);
        }
    } catch (IllegalArgumentException e) {
        Log.d(TAG, "You have one job! To turn on Remote Web Debugging! YOU HAVE FAILED! ");
        e.printStackTrace();
    } catch (NameNotFoundException e) {
        Log.d(TAG, "This should never happen: Your application's package can't be found.");
        e.printStackTrace();
    }

    settings.setGeolocationDatabasePath(databasePath);

    // Enable DOM storage
    settings.setDomStorageEnabled(true);

    // Enable built-in geolocation
    settings.setGeolocationEnabled(true);

    // Enable AppCache
    // Fix for CB-2282
    settings.setAppCacheMaxSize(5 * 1048576);
    String pathToCache = this.cordova.getActivity().getApplicationContext()
            .getDir("database", Context.MODE_PRIVATE).getPath();
    settings.setAppCachePath(pathToCache);
    settings.setAppCacheEnabled(true);

    // Fix for CB-1405
    // Google issue 4641
    this.updateUserAgentString();

    IntentFilter intentFilter = new IntentFilter();
    intentFilter.addAction(Intent.ACTION_CONFIGURATION_CHANGED);
    if (this.receiver == null) {
        this.receiver = new BroadcastReceiver() {
            @Override
            public void onReceive(Context context, Intent intent) {
                updateUserAgentString();
            }
        };
        this.cordova.getActivity().registerReceiver(this.receiver, intentFilter);
    }
    // end CB-1405

    pluginManager = new PluginManager(this, this.cordova);
    jsMessageQueue = new NativeToJsMessageQueue(this, cordova);
    exposedJsApi = new AndroidExposedJsApi(pluginManager, jsMessageQueue);
    resourceApi = new CordovaResourceApi(this.getContext(), pluginManager);
    exposeJsInterface();
}