开发者

How would I cache a gigabyte (a large amount) of local data in a PhoneGap application?

开发者 https://www.devze.com 2023-03-07 07:00 出处:网络
I\'d like to write a PhoneGap application that keeps a gigabyte of locally cached media files, like an e-reader. For example, the application might keep a local mirror of a folder on a web server. It

I'd like to write a PhoneGap application that keeps a gigabyte of locally cached media files, like an e-reader. For example, the application might keep a local mirror of a folder on a web server. It would resynchronize in the background as soon开发者_如何学编程 as it was started. I know I can cache a small amount of data using a manifest (ui assets). This is separate.


I've not tried this, but I'll take a swing at the answer. First off, it's important to know what device you're talking about here. PhoneGap is just a framework, and in and of itself doesn't necessarily have size limitations. It's less about what PhoneGap allows, and more about what iPhone, Android, Blackberry, etc allow.

I'm interpreting your use of the word "cached" in two different ways, and will try to address them separately.

Media files included with the app: Technically, you could simply include these media files as assets to your project. At least for iPhone, anyhow.

Looking around on SO for previous questions about max app size (iOS, Android), it appears that the max size for iOS apps is 2GB. Remember that if your app is over 20MB, it can no longer be an Over the Air download. Android max app size looks to be 50MB.

Media files downloaded after app has been installed: PhoneGap has a nice File API that allows you to save/access files in each device's documents directory. This might be what you're after.

I think that for iPhone, the only limitation is the existing amount of space on the user's device. I'm not sure about limitations for Android devices.

To restate, I'm taking a lot of guesses here. Might be worth your while to pose this question over at the PhoneGap Google Group.

0

精彩评论

暂无评论...
验证码 换一张
取 消