Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No success or error callback - Testing on Samsung S4 & S6 #396

Closed
WHarris22 opened this issue Dec 22, 2015 · 4 comments
Closed

No success or error callback - Testing on Samsung S4 & S6 #396

WHarris22 opened this issue Dec 22, 2015 · 4 comments

Comments

@WHarris22
Copy link

I have an Ionic app which uses this plugin to store data in a single table and I get an issue where I execute a query on the table and I receive no success or error callback instead it just hangs. It has happened on a Samsung S4 and S6 but I dont have a IOS test device so cannot confirm if its the same for IOS as well.

Closing the app and re-opening it opens the DB again and things start working again.

I have no idea what chain of events cause this (it just seems random) so replicating it is hard but my app consists of inserting a single record into said table, selecting ALL from table, updating a single record, and deleting a single record.

Also, it doesn't happen very often so 90% of the time the queries I have written will work as expected.

Just to note:

  • I use the ng-cordova wrapper class $cordovaSQLite.execute() so that queries get returned as promises.
  • I'm not working with much data either. It can happen with just 1-5 records in the table.

If you need more info or you want to see code let me know.

Update

I think I've found the cause for this. I have a list in one of my views and for each item there is an option to open it in the native Google maps app on the device. When I click this and then return to the app the database stops working. By not working I mean none of my queries return a success or error callback.

My code that opens the native map is:

 function OpenMap(sLat, sLng, eLat, eLng) {
        var googleUrl = 'http://maps.google.com/maps?saddr=' + sLat + ',' + sLng + '&daddr=' + eLat + ',' + eLng;
        window.open(encodeURI(googleUrl), '_blank');
}
@WHarris22 WHarris22 changed the title No callback issue - Samsung s4 & s6 No success or error callback - Testing on Samsung S4 & S6 Dec 22, 2015
@brodycj
Copy link
Contributor

brodycj commented Dec 23, 2015

I have never seen an issue like this before and find it really strange. I wonder if the issue is specific to this plugin or if it may affect other plugins such as cordova-plugin-file. You may want to try closing the database before such a window "navigation" event and reopening it when you need to do the database operation.

@WHarris22
Copy link
Author

It is really strange, would be good to know if anybody else has ever experienced this because I don't think any of my code does anything out of the ordinary.

I do make use of the cordova-plugin-file so I will knock up a test method and see what happens. I'm going to be out of office until the new year so won't be able to report back until then.

@WHarris22
Copy link
Author

I just realised I've experienced something like this before when using the Google Maps JavaScript API in an Ionic project and it turned out I didn't whitelist the URL in the config.xml.

i've just added <allow-intent href="*" /> to my config.xml as stated in the cordova-plugin-whitelist docs for when you use window.open() and I think that has now fixed it, shall I delete this issue now?

@brodycj
Copy link
Contributor

brodycj commented Dec 24, 2015

I documented this in README.md. I also published brodybits / Cordova-quick-start-checklist and brodybits / Cordova-troubleshooting-guide with tips to check the intent in the whitelist. Closing for now, please report if you find any related issues thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants