android-developers
[Arriba] [Todas las Listas]

[no subject]

To: android-developers@xxxxxxxxxxxxxxxx
Subject:
From: Mathias Lin <mail@xxxxxxxxxxxxxx>
Date: Tue, 30 Sep 2014 02:56:11 -0700 (PDT)
Delivery-date: Tue, 30 Sep 2014 05:57:22 -0400
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20120806; h=date:from:to:message-id:subject:mime-version:x-original-sender :reply-to:precedence:mailing-list:list-id:list-post:list-help :list-archive:sender:list-subscribe:list-unsubscribe:content-type; bh=4TKuhoxt59XCpVZNTVrQhbZ0cbH0hBY8DaCSlsJnfxc=; b=nlCT+dAhDSy4EFxsSyKaCuzzwvufIA2ANcRPE8XLhgqKHHhOyKYY3cExmsNQyDJ20y QxWs6QJk3iHmUj+9sog0vBrGhE3/7qO3P3VeUFJ/+xKLScMiK2nZHDPIRErgphxlZZO2 FpwYwaQhY/DiGlkCO6MAM8tSSck2FapZ6e8rofIzItIR7pSm9vmgwTGNBjxKu0uyz8RY qA30LuZqRig+h8mPVterZiwCBruCQbWQ65yc/1EkcQZm42iTJ9qYQYzmdofCa6unrKpF Ga9dbS1RaRUA9JvFajHP7bthHhwn9VgwEJEKlINmP3G1MMz7Mb68neEbOy8JAX3O/71u JIqw==
Envelope-to: traductor@xxxxxxxxxxx
List-archive: <http://groups.google.com/group/android-developer>
List-help: <http://groups.google.com/support/>, <mailto:android-developers+help@googlegroups.com>
List-id: <android-developers.googlegroups.com>
List-post: <http://groups.google.com/group/android-developers/post>, <mailto:android-developers@googlegroups.com>
List-subscribe: <http://groups.google.com/group/android-developers/subscribe>, <mailto:android-developers+subscribe@googlegroups.com>
List-unsubscribe: <mailto:googlegroups-manage+364598216046+unsubscribe@googlegroups.com>, <http://groups.google.com/group/android-developers/subscribe>
Mailing-list: list android-developers@xxxxxxxxxxxxxxxx; contact android-developers+owners@xxxxxxxxxxxxxxxx
Reply-to: android-developers@xxxxxxxxxxxxxxxx
Sender: android-developers@xxxxxxxxxxxxxxxx

I have a html5 application that I wrap in a WebView. To store and retrieve 
user input values between pages, I use the *localStorage* html5 feature.

It works fine on my Nexus 4 (Android 4.4.4), but it does not work on 
Samsung Galaxy Tab 2 (Android 4.3.x) (= nothing happens, but also no error 
in logcat). Or, to be more clear: *on Samsung, it does not work if the html 
pages are loaded from within the app's asset folder*. It does work though 
if I put the pages on a web server, as below in the outcommented line.

However, on Nexus 4, loading from file:///android_asset/ and also if I load 
the pages on a desktop browser (Chrome, Firefox) from file:// path, it is 
also working.

(I had another user reported the issue on a LG device, so it does not seem 
to be Samsung specific).

Below are the settings of the web view.

    webView = (WebView)this.findViewById(R.id.webView);
    webViewClient = new MyWebViewClient(this);
    webViewClient.setSm(sm);
    webView.setWebViewClient(webViewClient);
    WebSettings webSettings = webView.getSettings();
    webSettings.setJavaScriptEnabled(true);
    webSettings.setDomStorageEnabled(true);
    webView.getSettings().setJavaScriptEnabled(true);
    webView.getSettings().setDomStorageEnabled(true);
    webView.getSettings().setPluginState(WebSettings.PluginState.ON);
    webView.getSettings().setAppCacheEnabled(false);
    webView.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
    webView.getSettings().setUseWideViewPort(true);
    webView.getSettings().setLoadWithOverviewMode(true);
    webView.getSettings().setBuiltInZoomControls(false);
    webView.getSettings().setSupportZoom(false);
    webView.getSettings().setDefaultZoom(WebSettings.ZoomDensity.FAR);

    webView.loadUrl("file:///android_asset/01_home.html"); // does NOT work!
    // webView.loadUrl("http://192.168.178.33/01_home.html";); // does work!

Local storage code in the pages:

// storingvar data = document.getElementById('data').value;
window.localStorage.setItem((1), data);
// reading
document.getElementById('data').value = window.localStorage.getItem(1);

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@xxxxxxxxxxxxxxxx
To unsubscribe from this group, send email to
android-developers+unsubscribe@xxxxxxxxxxxxxxxx
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups "Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscribe@xxxxxxxxxxxxxxxx.
For more options, visit https://groups.google.com/d/optout.
<Anterior por Tema] Tema Actual [Siguiente por Tema>