APP API Reference

FeedHenry provides a JavaScript API to access functionality on handsets and on the cloud in a cross-platform way. By abstracting-out the platform-specific implementations, you can build apps which work across a wide range of platforms and can also access powerful server-side functionality.

If you are not familiar with our client-server architecture, please refer to our Introductory material.

Using the API

The FeedHenry JavaScript API is provided in the $fh namespace and uses a common convention for most functions, which takes the format:

$fh.doSomething(parameterObject, successFunction, failureFunction)

where parameterObject is an ordinary JavaScript object. The successFunction callback is called if the operation was successful and the failureFunction callback is called if the operation fails. All of these arguments are optional. If there is only one function, it is taken as the success function.

The successFunction callback is called with one argument, a result object, which is again an ordinary JavaScript object. The failureFunction callback is called with three arguments: an error code string, an object containing additional error properties (if any), and finally the original parameterObject.

The full list of available functions is as follows:

On-Device APIs

  • Accelerometer Interact with the Motion Sensor $fh.acc
  • Actions Call Cloud JavaScript functions $fh.act
  • Audio Stream and control audio $fh.audio
  • Camera Capture a photo using the device's camera $fh.cam
  • Contacts Interact with the Device contacts $fh.contacts
  • Device Environment Properties Access Device and application Environment Properties $fh.env
  • File Operate on files of the device $fh.file
  • Geolocation Access the device geolocation service $fh.geo
  • Geo IP Lookup the user's location based on their IP address $fh.geoip
  • Hashing Generate hash values of given inputs $fh.hash
  • Handlers Assign functions to the device's hardware buttons $fh.handlers
  • Local Storage Store data locally on the device $fh.data
  • Logging Log a message to the device console $fh.log
  • Mapping Show google maps in the application $fh.map
  • Push Notifications Setup Client part of push notifications for your App $fh.push
  • Messaging Send an email, SMS or IM $fh.send
  • Notification Device notification - Blink, beep, vibrate $fh.notify
  • Ready Determine when the on-device API is initialised $fh.ready
  • Security Used for key generation and data encryption/decryption $fh.sec
  • Web Requests Perform external web requests $fh.web
  • Web View Open a website in-app $fh.webview

Cloud APIs

  • Web Requests Perform external web requests $fh.web
  • Cache Save an object in memcache for a period of time in the cloud $fh.cache
  • Push Notifications Setup Cloud part of push notifications for your App $fh.push
  • Read RSS Feed Read RSS feeds from a link $fh.feed
  • Logging Log a message to debugging section of the App Studio $fh.log
  • Hashing Generate hash value of a given input $fh.hash
  • Security Used for key generation and data encryption/decryption $fh.sec
  • Parsing Parse a JSON string into a javascript object $fh.parse
  • Stringification Convert a javascript object to a string representation $fh.stringify
  • Data Storage Save an object in persistent storage in the cloud $fh.db
  • Utility Provides access to cloud side utitlity functions. $fh.util