Reminder - You don't need AppCache for PhoneGap/Cordova

I've seen this come up a few times recently, and it was mentioned in a presentation I attended yesterday on PhoneGap, but just as a reminder, stop worrying about AppCache and PhoneGap/Cordova. It may not be entirely clear to people new to hybrid mobile development, but your application is on the device itself. AppCache makes no sense in this regard. It is a bit like having an HTML file on your desktop. Whether you are online or not does not matter!

However...

You obviously do need to care about if the user is offline or not. First - if you are using a CDN for jQuery or some other library - stop. Just download the bits locally to your application and point to them there.

Secondly, if you are using any remote APIs, then certainly you need to check the device's online/offline status. Make use of the Network Information plugin (*) and spend time to ensure your application responds correctly to different network conditions. I covered this way back in 2013 (Building "Robust" PhoneGap Applications) and I discuss it in my Cordova book.

  • As just a quick aside, I know some folks have had reliability issues with the Network Information plugin. I've seen some people actually write a simple XHR utility to hit a known URL and check the result. I've not had this issue myself, but I wanted to bring it up as just a warning that the plugin may not be perfect. Even if a user is reported as being online, I would hope you build your API calls with error handling. Heck, the API provider may be down themselves.

Like This?

If you like this article, please consider visiting my Amazon Wishlist or donating via PayPal to show your support. You can also subscribe to the email feed to get notified of new posts.