diff options
author | Struan Donald <struan@exo.org.uk> | 2012-11-26 16:27:05 +0000 |
---|---|---|
committer | Struan Donald <struan@exo.org.uk> | 2012-11-26 16:27:05 +0000 |
commit | 706d382ef0182bc33109d30878ac498d8cd5add7 (patch) | |
tree | cce843d20ab51cf4c48ebff1557acf11ad95ada2 /www/js | |
parent | 0a205c019e6fc61d54cf49bfc87ebcaab0644735 (diff) |
onDeviceLoad does not seem to work on emulator so put in extra checks
Diffstat (limited to 'www/js')
-rw-r--r-- | www/js/mobile.js | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/www/js/mobile.js b/www/js/mobile.js index b58f5da..15a813b 100644 --- a/www/js/mobile.js +++ b/www/js/mobile.js @@ -156,6 +156,7 @@ function foundLocation(myLocation) { var location_error_str = ''; function notFoundLocation() { + $.mobile.loading( 'hide' ); if ( watch_id ) { location_error_str = 'Could not find location'; navigator.geolocation.clearWatch(watch_id); @@ -704,12 +705,15 @@ var geocheck_count = 0; function decide_front_page() { $.mobile.loading( 'show' ); - if ( !can_geolocate || geocheck_count < 10 ) { + if ( !can_geolocate && ( !navigator.network || !navigator.network.connection ) ) { geocheck_count++; - window.setTimeout( decide_front_page, 100 ); + window.setTimeout( decide_front_page, 1000 ); return; } + // sometime onDeviceReady does not fire so set this here to be sure + can_geolocate = true; + geocheck_count = 0; localStorage.offline = 0; @@ -725,8 +729,8 @@ function decide_front_page() { } function locate_page_display() { + $.mobile.loading( 'hide' ); if ( watch_id ) { - $.mobile.loading( 'hide' ); navigator.geolocation.clearWatch(watch_id); watch_id = null; } |