Intel cloud context services

Intel cloud services context plugin
intelcloud0.1.00
platforms: android,ios
$ cordova plugin add org.intel.context

Intel Cloud Services Plugin - Context - Phonegap

Documentation

Context functions

context.service

This object contains the following properties: name and urn

context.initCallbacks(onReceivedItem, onError)

Initialize the callbacks for context services. This function receives the following parameters:

  • onReceivedItem: This parameter is a function defined by one parameter: type. This last parameter will contain the urn (in string format) of the item received on context services (for example, contacts or battery types).

  • onError: This parameter is a function defined by one parameter: error. This last parameter will contain all errors received from context services api.

context.getServices(services, errorCallback)

This function returns the allowed services for the current platform. For example, in android the "messages service" is allowed, but not on iOS.

  • services: Collection of services objects. Each object contains "name" and "urn" properties.

Note: In the context.init method, must be specified "context.services" objects. The collection received by parameter in this function is not the same as context.services objects.

  • errorCallback: This function will be executed if occurs an error while the services was getting. The returned parameter in this function is the error.

context.init(services, callback, errorCallback)

This function initializes the list of services passed by the first parameter (must be a collection of context.services objects).

  • services: The list of services to initialize.

  • callback: This function will be executed if the specified services have been initialized properly.

  • errorCallback: This function will be executed if occurs an error while the services was starting. The returned parameter in this function is the error.

context.stop(services, callback, errorCallback)

This function stops all the working providers at this moment.

  • callback: This function will be executed if the specified services have been stopped properly.

  • errorCallback: This function will be executed if occurs an error while the services was stopping. The returned parameter in this function is the error.

context.checkStatus(callback, errorCallback)

This function gets the actual status of context service.

  • callback: This function returns one parameter with the status of the context services. If the state (parameter returned by this function) is true, then the context service is already enabled, otherwise the service context is not enabled yet.

  • errorCallback: This function will be executed if occurs an error while was getting the status of the context service. The returned parameter in this function is the error.