Tuesday, January 31, 2012

[android-developers] Re: Javascript openDatabase callback never executes

Hi and thanks for both replies.

I have set a database path and on a rooted device verified that all is
working as intended.

Shame the callback is not supported on the older versions of Android -
i shall have to think up a workaround in the javascript.

Martin.


On Jan 30, 8:48 pm, John Purcell <jsp...@gmail.com> wrote:
> Also keep in mind that certain versions of Android you should/must
> give webkit a custom path for your databases
> (websettings.setDatabasePath(), et al), which can be set on a per view
> basis (unlike AppCache, which is a singleton per app).
>
> On Jan 29, 1:26 am, Martin <warwo...@gmail.com> wrote:
>
>
>
>
>
>
>
> > Hi.
>
> > I'm using the Database Storage API in a WebView and have been
> > researching the available javascript methods.
>
> > The javascript openDatabase() method is documented to have an optional
> > fifth parameter which is a callback function to execute once the
> > openDatabase() method has completed (but only if the database has been
> > created - see below).
>
> > The openDatabase() method is asyncronous so i need to query the
> > database after it has been created and is ready for use, NOT after the
> > openDatabase() method has been executed.
>
> > Hope that makes sense but anyway my question is does the WebView's
> > javascript openDatabase() method support this fifth optional
> > parameter?
>
> > Some example javascript:
>
> > function dbCreated(transaction){
> >         console.log('debug#2');}
>
> > console.log('debug#1');
> > var shortName='locationTracker', version='1.0', displayName='Some
> > text', maxSize=32768;
> > var database=openDatabase(shortName, version, displayName, maxSize,
> > dbCreated);
> > console.log('debug#3');
>
> > In the log i see 'debug#1' and 'debug#3' but never see 'debug#2'.
>
> > The callback is supposed to only be called if the database has been
> > created and opened.
> > It is not called if the database already existed and has been opened
> > but not created.
>
> >http://html5doctor.com/introducing-web-sql-databases/
>
> > Scroll down to 'Creating and Opening Databases' and 5. Creation
> > callback.
>
> > I've uninstalled my app a few times and reinstalled it - thinking that
> > the database definitely will not exist so will be created and the
> > callback will execute but the callback still fails to execute.
>
> > This is on a Froyo emulator and also on my ZTE Blade with cyanogen mod
> > Gingerbread.
>
> > Has anyone got any experience with the javascript database storage api
> > and could tell me if this callback is supported?
>
> > Thanks.
>
> > Martin.

--
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@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment