Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Create db fails when running in an Android Phonegap application. #589

Closed
MattFriedman opened this Issue · 4 comments

3 participants

@MattFriedman

I've been attempting to get Pouchdb to work inside of an Android Phonegap application. I'm using the latest version of phonegap/cordova and the pouchdb nightly js file.

I have noticed that the log complains about dbid being undefined. Changing the sql from

var dbid = 'SELECT dbid FROM ' + META_STORE;
to
var dbid = 'SELECT * FROM ' + META_STORE;
fixes that error but I don't know why.

Once the system can get past the dbid issue you see errors in the log such as
I/Web Console( 1180): Transaction error calling user success callback: TypeError: Cannot call method 'ready' of undefined at file:///android_asset/www/cordova-2.5.0.js:4168

The create db code I'm using looks like this:

var database;
            Pouch('listoutfitter', {}, function (err, db) {

                if(err) {

                    console.log(" $$$$$  create db  $$$$$$$$$$  err " + err)

                    for( var e in err) {
                        console.log("Error element: " + e + " -> "  + err[e]);
                    }

                    return;
                }

                console.log(" $$$$$$$$$$$$    Created new database.   )))))))))))))))))))");

                database = db;

                db.post({_id: 'doc1', title: 'Cony Island Baby' }, {}, function (err, response) {

                    console.log("created doc: " + response.ok);
                    console.log("doc id:  " + response.id)
                    console.log("rev: " + response.rev)

                })


            });

This results in these log msgs:

D/CordovaLog( 1313):  $$$$$  create db  $$$$$$$$$$  err [object Object]
I/Web Console( 1313):  $$$$$  create db  $$$$$$$$$$  err [object Object] at file:///android_asset/www/index.html:54
D/CordovaLog( 1313): Error element: status -> 500
I/Web Console( 1313): Error element: status -> 500 at file:///android_asset/www/index.html:57
D/CordovaLog( 1313): Error element: error -> undefined
I/Web Console( 1313): Error element: error -> undefined at file:///android_asset/www/index.html:57
D/CordovaLog( 1313): Error element: reason -> undefined
I/Web Console( 1313): Error element: reason -> undefined at file:///android_asset/www/index.html:57

Overall I'd like to know if a Phonegap application on Android using Pouchdb is meant to work. Is Android phonegap a valid target or am I barking up the wrong tree?

I do appreciate any input provided. I was trying to get some attention on the google group but I couldn't seem to get any responses there; hoping to get some responses here at Github.

Please let me know if I should keep going with my endevour to get this working in an Android phonegap app, or if it's not going to happen.

Thanks,
Matt

@daleharvey
Owner

Sorry I thought I had replied to this.

Phonegap is definitely a valid target for pouchdb, its undertested right now however there has been a lot of interest in using pouchdb with phonegap and its going to be a pretty important platform for us

@howonlee is taking a look at this now, it might also be worth following #377

@MattFriedman

That's great news. I have it working in an iOS Phonegap app. If I had a better understanding of how to run the tests on each platform I could spend some time looking at the issues as well, but I've not quite been able to sort out how to do that. In any case, its a great project and I really appreciate your efforts. Thanks, Matt

@chesles

What's the status on this issue? #377 is closed as of a few days ago, so if this is confirmed to be working we should close this too. Somebody on StackOverflow was asking about issues with Pouch/PhoneGap Android as well: http://stackoverflow.com/q/16053776/223594. I pointed him to #377 and #670 for reference.

@MattFriedman can you confirm if this is working or not for you with the latest build?

@daleharvey
Owner

Yeh I was supposed to close this one as well, @howonlee has had successful test runs in phonegap using the latest build so we should be good (but hopefully will get phonegap into CI at some point)

@daleharvey daleharvey closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.