13 Apr 2012 11:35 AM #1
Unanswered: Catching Google Maps error when starting app while offline
I have integrated Google Maps Api 3 in my app but when I'm offline (having no internet connection) and start the app the following error is thrown:
file:///android_asset/www/app/views/map/MapView.js: Line 144 : Uncaught ReferenceError: google is not defined o 04-13 21:48:12.234: E/Web Console(1369): Uncaught ReferenceError: google is not defined at file:///android_asset/www/app/views/map/MapView.js:144
Any tips or advices how/where to wrap an try&catch statement?
Thanks in advance,
16 Apr 2012 6:58 AM #2
- Join Date
- Mar 2007
- Gainesville, FL
- Vote Rating
You can do something like
google && google.something.FooMitchell Simoens @LikelyMitch
Sencha Inc, Senior Software Engineer
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services firstname.lastname@example.org
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!
When posting code, please use BBCode's CODE tags.
29 Jul 2013 7:32 AM #3
this post interests me too
can you please give some more information about the code you posted
I cannot handle any code when google.maps is not loaded (due to missing connection); no way to catch the rising error
another solution could be to 'require' the view only if the google.maps is defined, but I'm not sure it is possible someway!
thank you for any additional suggestion, alex
7 Jan 2014 11:35 PM #4
Further on this topic I would like to find out how a Phonegap-wrapped app will behave with no internet connection.Is there a way of loading & caching the Google Maps library so that (a) you don't get the error and (b) later at some point when you are connected, maps will load. I am unclear of the implications of an app loading when offline & coming online at a later stage - whether map-related content will be available then.If one is using Google Maps in a Phonegap-wrapped app how does one handle the loading/online/offline switching + map integration - ie:- app loads, is not online- user tries to access map-related content- after a period of time app goes online- user tries to access map-related content
8 Jan 2014 10:49 PM #5
For anyone experiencing the same issue, here are 2 useful links.
I managed to get it to work with loading the js asynchronously when the user changes to an online state.