Get the download on App Cloud's File Download API

Your content-centric app is only as good as the network it's running on—until now. With App Cloud's File Download API, you can permanently store all kinds of media assets on the device for offline use. Text feeds, images, PDF documents, audio and video files, you name it. This presents lots of possibilities for app developers:

  • Your apps can degrade gracefully when the user's network goes in and out
  • You can program your apps to front-load content so they work perfectly in "airplane mode"
  • You can allow users to create custom content experiences that work anywhere, anytime

Of course, your app can do all of the above. Here's a quick look at the methods and events in the File Download API:

Methods

  • bc.device.requestDownload(...): Download a file from a remote URL
  • bc.device.removeDownload(...): Delete a previously downloaded file
  • bc.device.isDownloadAvailable(...): Determine if the device supports file downloading
  • bc.device.getDownloadInfo(...): Get information about previously downloaded files

As with other device methods, these are asynchronous—you provide success and error callbacks.

Events

  • downloadprogress: Dispatched on each progress event at the specified interval (e.g. 5%) (iOS only)
  • downloadcomplete: Dispatched when a download finishes
  • downloaderror: Dispatched on certain error conditions

The API is low-level by design, requiring you to use bc.core.cache() to store associated metadata in most situations. I've written a FileManager class to hide some of the implementation details of downloading, retrieving and deleting files—check it out in the App Cloud Demos repository, then get downloading!

p.s. Get more tips and tricks (and share your own) by joining the Brightcove App Cloud discussion group on Google.