Start a new topic

Access to the WebDatabase API is denied on Android

Access to the WebDatabase API is denied on Android


After launching WikitudePlugin.loadARchitectWorld('...') with Radar and Poi Detail,

I get error log as follows and I can't connect to Web SQL...

W/PluginManager(4060): THREAD WARNING: exec() call to WikitudePlugin.isDeviceSupported blocked the main thread for 37ms. Plugin should use CordovaInterface.getThreadPool().

I/Choreographer(4060): Skipped 60 frames!  The application may be doing too much work on its main thread.

Uncaught SecurityError: Failed to execute 'openDatabase' on 'Window': Access to the WebDatabase API is denied in this context.

Uncaught TypeError: Cannot call method 'transaction' of undefined

I tried to change code "WikitudePlugin.java" like from

this.cordova.getActivity().runOnUiThread( new Runnable() {

to

this.cordova.getThreadPool().execute(

but that does not improve.

Please help me and give me any hint...

Hi, I need some more information about this issue.

Which device and Android version are you testing? Can you check the same application on Android 4.4? Can you write a test application on PhoneGap without using the Wikitude Plugin and access the same API from that application?

The "Access to the WebDatabase API is denied in this context" is an error message from the Android subsystem, and "SecurityError" means that the WebView is not allowed to access that API. On Android 4.0 up to 4.3, if you are loading HTML code from the local resources of an application, this is considered insecure, and some features are disabled (LocalStorage is an example). This behaviour changed with Android 4.4.

Hi, Gabriele.
Thank you for your reply.

> Which device and Android version are you testing? Can you check the same application on Android 4.4?
> Can you write a test application on PhoneGap without using the Wikitude Plugin and access the same API from that application?

I'm testing with several devices.(Nexus5 / Galaxy Nexus / Xperia Acro).
On Android 2.3 works fine as expected.
but Android 4 is not good.
Until I launch the Wikitude plugin, all functions including WebDatabase work fine. only after launched wikitude it's going bad...

> The "Access to the WebDatabase API is denied in this context" is an error message from the Android subsystem, and "SecurityError" means
> that the WebView is not allowed to access that API. On Android 4.0 up to 4.3, if you are loading HTML code from the local resources
> of an application, this is considered insecure, and some features are disabled (LocalStorage is an example). This behaviour changed with Android 4.4.

As mentioned above, it is a result of Wikitude problem.
I suspect the increase in memory caused by Wikitude is being inhibited.( or CPU usage)
What do you think about it?

Could you send us a sample world (or a test project) we can use to reproduce the problem?

I'm not aware of any problem with the web database, but I know that local storage is disabled in android 4.0 up to 4.3, when the file is loaded from the local assets.

Are you using the function in your phonegap application, or inside the HTML code of your AR world? (or both)?

Hi, Gabriele.
Thank you for your help.

> Could you send us a sample world (or a test project) we can use to
> reproduce the problem?

Yes, of course. but how can I send you a sample world?
by posting to this board?

> I'm not aware of any problem with the web database, but I know that local
> storage is disabled in android 4.0 up to 4.3, when the file is loaded from
> the local assets.
>
> Are you using the function in your phonegap application, or inside the
> HTML code of your AR world? (or both)?

I'm using only in my phonegap app.
If I restart my app after hungup, I can use web database successfully.

You can attach your files (for example as a ZIP) to a message in this forum, or send them via e-mail to info@wikitude.com

I've received your ZIP file, and it looks like this problem is a known issue, which is already fixed in our internal testing release.

The fix will be available soon (after internal testing is done).

> I've received your ZIP file, and it looks like this problem is a known
> issue, which is already fixed in our internal testing release.
>
> The fix will be available soon (after internal testing is done).

Thank you Gabriele!

I'll wait newer version.

We released a new version of the phonegap plugin, your issue should be solved, could you please check if it's working now?

Thank you Gabriele. It works fine!!

Grazie!
Login or Signup to post a comment