質問

I'm currently developing a single page web application. I'll post it on the AppStore and Play Store with PhoneGap. To run my app offline, I use the HTML5 Cache Manifest : its final size is around 10MB.

When I test my app on google chrome, everything loads normally. :)
After that, I created an APK with PhoneGap to test the application on my Nexus 4.
Unfortunately I realized that the cache size is limited to 5MB. I reduced the weight of the cache to 5MB, the cache loads correctly ! :)

I update the cache, I run the application and I get an error...
After some tests, if the cache size is less than 2.5MB loading and updating the cache works.

I'd like to know if it's possible to increase the size limit of Cache Manifest with PhoneGap?

Thanks in advance,

Matthieu

役に立ちましたか?

解決

It's possible. You have to extend you app.java with the following lines.

//version 7+
//method available since API level 7 
if(android.os.Build.VERSION.SDK_INT >= 7) {
    //set custom cache size (20 MB), as the default seems to be to small (5 MB)
    //this is deprecated from SDK 18 but seems still to be needed
    super.appView.getSettings().setAppCacheMaxSize(1024*1024*20);
}

We had some Error 10 on SQL transaction updates and this patch fixed it by setting the limit to 20 MB.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top