android

HTML5 Ajax Call Timeout and 3G Wireless Radio

Because of the 3G wireless radio state machine (see Optimize downloads for efficient network access), the radio takes around 2 seconds from StandBy to Full Power state. Full Power Radio is used when a connection is active, allowing the device to transfer data at its highest possible rate.

If an Ajax Call is needed when the Android Device is in Sleeping Mode (thus, radio in StandBy state), the request timeout must account for the 2 seconds the radio needs to transition to the Full Power state. Otherwise, the Ajax Call may be finished before the data transfer is completed. For instance, my experience showed that with 3 seconds timeouts, the call was terminated before getting the answer from the server.

SECURITY_ERR: DOM Exception 18 when Opening WebSql Database in Android 4.3 WebView (API level 18)

Context:

    • Webview with myWebView.getSettings().setDatabaseEnabled(true);

    • App working fine for many years.

    • Usage of javascript instruction openDatabase("db_name", "1.0", "db_name", 50 * 1024); in WebView loaded pages.

    • As of 13/12/2016, suddenly openDatabase triggers a DOM Exception 18 and the app does not work anymore. I presume due to one of the last Android system updates.

Solution:

To solve this issue you need to do from Android 4.3 WebView:

    1. set DatabasePath

    2. override onExceededDatabaseQuota

You need to do this even if the IDE complains about this functions being overriden in API level >= 19.

More info related to this problem can be found here.

Trust Anchor Error on Android Webview SDKVersion > 23

Context:

Trusted user CA certificate installed in Android phone. Android Webview App works fine with SDKVersion <=23. With SDKVersion >23, you get a SslError.SSL_UNTRUSTED (missing trust anchor) error.

Solution:

You need to tell Android App to trust user CA certificates by means of a Network security configuration config file. In this file, you can include the next text

<?xml version="1.0" encoding="utf-8"?>

<network-security-config>

<base-config>

<trust-anchors>

<!-- Trust preinstalled CAs -->

<certificates src="system" />

<!-- Additionally trust user added CAs -->

<certificates src="user" />

</trust-anchors>

</base-config>

</network-security-config>

More on this issue can be found in this stackoverflow thread.


Can't Install APK in Android 6 Despite minSdkVersion 23 or Lower

If you sign the app, make sure you don't use signature v2, but v1.