Discussion Forums  >  Images, Documents, File Locations

Replies: 7    Views: 138

clhend
Aspiring developer
Profile
Posts: 76
Reg: Dec 23, 2014
Weatherford, TX
5,460
06/01/15 06:10 AM (4 years ago)

Files Not Caching on Device

When I activate the app on my device, the first time I access a file, it downloads. I can go to other files and move around the app, and if I go back to that file, it's still there and I don't have to download it again.

However, once I leave the app it appears that any cached files are deleted. It doesn't seem to matter whether the file is hosted on my website or whether it's included in the app's files. The next time I try to access that file I have to download it again.

This could be a real problem, because right now I can't access the app if I'm offline. The Wi-Fi has to be on for me to even turn on the app.
 
Dusko
Veteran developer
Profile
Posts: 998
Reg: Oct 13, 2012
Beograd
22,680
like
06/01/15 06:22 AM (4 years ago)
You do not have to post essentially the same complaint twice within a couple of minutes.

As for caching, it will depend on the code of the plugin. The plugins that David Book created, will always cache the files. So will be the case with plugins that use the David's code, like the Susane's plugins. However, there really is no obligation for a plugin to cache anything, that will depend on what the plugin's creator wrote, how, and why. If you have a plugin that does not cache files and you would like it to, try to talk to the plugin developer first. Maybe they will be able to add code to the plugin, and then again, maybe not, it will depend.

There is nothing to stop you from using the files directly in the app, on the device. That will be fastest and, generally, for the best. However, you must manually copy the files into the app, BT server will not do it for you. In particular, if you are using the option Files / Media in control panel, then know that BT will not download these files for you, you will have to do it manually once again.

This makes this option almost useless, but there it is, for better or worse.

So, make your apps as self reliant as possible, and know that if you need to, you can later, while the app is published, read images from a dataURL, at least for the "classic" BT plugins.
 
clhend
Aspiring developer
Profile
Posts: 76
Reg: Dec 23, 2014
Weatherford, TX
5,460
like
06/01/15 06:32 AM (4 years ago)
Sorry that you see my questions as complaints, but I didn't realize they were really related as I'm still learning terminology.

For instance, I don't know how to "manually copy the files into the app".

The whole idea of the app is for it to be as "self-reliant as possible", but didn't realize that caching wasn't automatic but dependent upon the particular plug-in.
 
Dusko
Veteran developer
Profile
Posts: 998
Reg: Oct 13, 2012
Beograd
22,680
like
06/01/15 06:51 AM (4 years ago)
>how to "manually copy the files into the app"

Use your operating system to copy images into the BT_Doc folder on disk, or, you can use the editor to do that... Android Studio or Xcode, depending on the platform.
 
clhend
Aspiring developer
Profile
Posts: 76
Reg: Dec 23, 2014
Weatherford, TX
5,460
like
06/01/15 06:56 AM (4 years ago)
Thank you. I did check all of the plugins I'm using and they all state that once a file is downloaded it is then cached for use offline.

Is it possible that since I'm still building the app and haven't actually published it so that it is only on my smartphone that it won't cache files?

Could that also be the reason that if Wi-Fi isn't available that the app won't even activate?
 
clhend
Aspiring developer
Profile
Posts: 76
Reg: Dec 23, 2014
Weatherford, TX
5,460
like
06/01/15 07:06 AM (4 years ago)
Okay, here's the error message I get when I try to start the app when it is offline:

"There was a problem loading the app's configuration data. See the Output Console in your development tool (Eclipse, Android Studio, etc)."

Did I miss something when I was configuring?

If this is not a question that should be asked here (am I'm not complaining) then if you'll let me know where it should be asked, I'll ask it there.

Thank you,
 
Dusko
Veteran developer
Profile
Posts: 998
Reg: Oct 13, 2012
Beograd
22,680
like
06/01/15 07:28 AM (4 years ago)
>Is it possible that since I'm still building the app and haven't actually published it so that it is only on my smartphone that it won't cache files?

No.
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
06/01/15 07:29 AM (4 years ago)
That's a little odd; that message is for the BT_config.txt file.

One of the things I usually do (rather routinely) is after a few changes in the control panel, I will copy (from the json config tab in the app control panel) the most current json config, paste it into 'jsonlint.com' (to format it in an easier to read layout) and then replace my BT_config.txt data in the app (usually just a simple erase old data, paste new data).

The way it is 'supposed' to work is, the app upon first launch, it will read the internal BT_config.txt file, then it (usually) tries to 'phone home' and see if there is a more recent configuration. If there is one, it downloads it and implements it. This of course, needs a network connection (either wifi or cell data), but if no data connection is available, it should just use the 'last known config' that it has.

Not sure why yours isn't doing that. But it might be worth reading GoNorthWest's white paper on offline access and refresh...

http://www.buzztouch.com/resources/Understanding_App_Refresh_and_Offline_Apps_v1.0.pdf

Hope this helps a little...

Cheers!

-- Smug
 

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.