Discussion Forums  >  Config Data, JSON, App Refresh

Replies: 5    Views: 348

GoNorthWest
buzztouch Evangelist
Profile
Posts: 8197
Reg: Jun 24, 2011
Oro Valley, AZ
1,000,000
06/04/15 03:33 PM (9 years ago)

Android Offline Mode Issue

Hello! Working with @clhend on an app, and we're having issues with getting the app to start when the device is offline. Here's what's happening: * Emulator is set to Airplane Mode * Load App, and you see the following things in LogCat (with my comments in parenthesis, and only select, relevant entries pasted): - (Recognizes there is no network connection) BT_device:updateDeviceConnectionType: ConnectionType: NONE - (Loading the config file that's included with the package) BT_fragment_load_config_data:loadAppConfigData loading "BT_config.txt" from /assests folder in project... - (Reading the confif file that's included with the package) BT_fileManager: readTextFileFromAssets: "/BT_config.txt" - (Getting the dataURL from the config file) BT_application: getDataURLFromAppData - (Verifies a dataURL is specified) BT_fragment_load_config_data:loadAppConfigData "BT_config.txt" file does use a dataURL for remote updates... - (Sees that there is a cached copy of the config file) BT_fileManager: readTextFileFromCache: "cachedAppConfig.txt" - (Reads the cached copy of the config file) BT_fragment_load_config_data:loadAppConfigData reading cachedAppConfig.txt from the applications download cache... - (Decides to use cached copy of config file) BT_fragment_load_config_data:loadAppConfigData ignoring BT_config.txt file included in the project (using cached version instead)... - (Validates the JSON is good, so the config file is good) BT_fragment_load_config_data:loadAppConfigData application data appears to be valid JSON... - (Successfully parses all the app data) BT_application:parseJSONData done parsing application data - (Tries to download latest config data) BT_fragment_load_config_data:loadAppConfigData downloading app data from: https://www.buzztouch.com/api/app/?command=getAppData&appGuid=XXX&apiKey=XXX&apiSecret=XXX&currentMode=Design - (Exception thrown because it can't resolve the URL) BT_downloader:downloadTextData from URL EXCEPTION: java.net.UnknownHostException: Unable to resolve host "www.buzztouch.com": No address associated with hostname URL: https://www.buzztouch.com/api/app/?command=getAppData&appGuid=XXX&apiKey=XXX&apiSecret=XXX&currentMode=Design - (No idea what this means) BT_fragment_load_config_data:loadAppConfigData An exception occurred (55). java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare() * At this point, the app throws up a message saying the config data can't be downloaded (because of the absent network). However...it was able to successfully read the cached copy of the config file. Shouldn't that be enough to render the app? Anybody have any thoughts? Are your BTv3 Android apps working in Offline mode at the moment? Thanks! Mark
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
06/04/15 05:46 PM (9 years ago)
I just shut off wifi for my app 'Flores Museum', and it seems to work ok just fine with or without. Odd that it crashes during the 'phone home' part; that's usually pretty stable, so I'm not sure which direction to go in... looking up that 'looper' error, I seem to get the same basic answer; trying to create a thread from a background task outside of the 'main' thread. But I have *no* clue what to do about it. I wonder if something else is throwing it off, because my BTv3 app works fine offline...? If it works without phoning home, then yeah, it's probably an issue with downloading the file, or something with wifi (although I can't be totally sure). If you take it totally offline (no updates) and it still crashes, maybe it will point a little closer to the real problem?? I'm just taking a stab; I can't be really certain just yet. Cheers! -- Smug
 
GoNorthWest
buzztouch Evangelist
Profile
Posts: 8197
Reg: Jun 24, 2011
Oro Valley, AZ
1,000,000
like
06/05/15 12:25 AM (9 years ago)
Thanks for investigating! I'll mess around more with various offline states and see what happens. Very odd that it doesn't work on her device or an emulator. I'll have to hunt down my tablet and see if that changes things. I'll keep you posted! Mark
 
AlanMac
Aspiring developer
Profile
Posts: 2612
Reg: Mar 05, 2012
Esher, UK
37,120
like
06/05/15 08:19 AM (9 years ago)
Way back in the dim and distant past I had this issue in Android, it was linked to an image on the home page not being available. I'm assuming (because it's you) that is unlikely to be your issue. The other time I saw this, was related to push notifications. I was using Parse at the time (long time back). I took out push and all was fine again. Alan PS - happy to download and test your apk if it helps.
 
GoNorthWest
buzztouch Evangelist
Profile
Posts: 8197
Reg: Jun 24, 2011
Oro Valley, AZ
1,000,000
like
06/05/15 09:16 AM (9 years ago)
Hmmm...that's something worth investigating. I'm certainly not infallible, and it's not my app, so anything is possible! I'll go back and check in more detail and see what I can discover! Mark
 
fusionsch
I hate code!
Profile
Posts: 516
Reg: Dec 28, 2010
Montreux Switze...
11,610
like
06/16/15 06:39 AM (9 years ago)
Hi Mark, I'm stuck on a similar issue... Check this thread: https://www.buzztouch.com/forum/thread.php?tid=3A3CED04F4149B0126B37A6 Still no solution... Big problem, as all the apps I create have to be usable when offline or in airplane mode! Cheers Jack
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.