Angular service

PxlController source

Exposes PixLive SDK methods using an angular-like service

Parameters
NameTypeDescription
$ionicPlatform service

The Ionic Platform helper

$q service

Angular promise service

Methods

addBookmark (contextId)

Add a new bookmark for a given context. The context corresponding to the contextId will be added to the bookmark list.

Parameters
NameTypeDescription
contextId string

the ID (from the pixlive.Context#contextId property of the Context object) of the context to add to the bookmark list

computeDistanceBetweenGPSPoints (lat1, lon1, lat2, lon2) -> Promise

Asynchronously return the list of GPS points in the bounding box specified by its lower left and uper right corner

Parameters
NameTypeDescription
lat1 Number

latitude of point 1

lon1 Number

longitude of point 1

lat2 Number

latitude of point 2

lon2 Number

longitude of point 2

Returns
TypeDescription
Promise

An Angular Promise where the success method will be called with a Number argument corresponding to distance between the two GPS points

getBookmarks -> Promise

Asynchronously return the list of contexts that have been bookmarked.

When bookmark support has been enabled (by calling cordova.plugins.PixLive.setBookmarkSupport(true)), a bookmark button is displayed on fullscreen content such as web pages. Clicking it will mark the content as bookmarked. The content that have been bookmarked can be retrieved using this method. You can also add and remove bookmarks programatically using the pixlive.PxlController#addBookmark / pixlive.PxlController#removeBookmark method

See pixlive.Context for the description of the Context class.

Returns
TypeDescription
Promise

An Angular Promise where the success method will be called with an Array<Context> argument corresponding to the context/content that have been bookmarked.

getContext (contextId) -> Promise

Asynchronously return the context with the given contextId if this context has been synchronized.

See pixlive.Context for the description of the Context class.

Parameters
NameTypeDescription
contextId string

the ID (from the pixlive.Context#contextId property of the Context object) of the context to add to the bookmark list

Returns
TypeDescription
Promise

An Angular Promise where the success method will be called with a Context argument corresponding to the context/content with the given contextId

getContexts -> Promise

Asynchronously return the list of contexts that is available within the app (i.e. the ones that have been synchronized.)

See pixlive.Context for the description of the Context class.

Returns
TypeDescription
Promise

An Angular Promise where the success method will be called with an Array<Context> argument corresponding to all the context/content contained in the app.

getGPSPointsInBoundingBox (latitude, longitude, latitude, longitude) -> Promise

Asynchronously return the list of GPS points in the bounding box specified by its lower left and uper right corner

See pixlive.GPSPoint for the description of the GPSPoint class.

Parameters
NameTypeDescription
latitude Number

of the lower left corner

longitude Number

of the lower left corner

latitude Number

of the uper right corner

longitude Number

of the uper right corner

Returns
TypeDescription
Promise

An Angular Promise where the success method will be called with an Array<GPSPoint> argument corresponding to GPS points in the specified bounding box

getNearbyBeacons -> Promise

Asynchronously return the list of contexts linked to nearby beacons

See pixlive.Context for the description of the Context class.

Returns
TypeDescription
Promise

An Angular Promise where the success method will be called with an Array<Context> argument corresponding to the context/content linked to nearby beacons

getNearbyGPSPoints (myLat, myLon) -> Promise

Asynchronously return the list of nearby GPS points

See pixlive.GPSPoint for the description of the GPSPoint class.

Parameters
NameTypeDescription
myLat Number

current latitude

myLon Number

current longitude

Returns
TypeDescription
Promise

An Angular Promise where the success method will be called with an Array<GPSPoint> argument corresponding to nearby GPS points

isBookmarked (contextId) -> Promise

Asynchronously returns true or false depending if the context identifier by contextId (its ID) has been bookmarked or not.

Parameters
NameTypeDescription
contextId string

the ID (from the pixlive.Context#contextId property of the Context object) of the context to check

Returns
TypeDescription
Promise

An Angular Promise where the success method will be called with an boolean argument indicating if the context has been bookmarked (true) or not (false)

isContainingGPSPoints -> Promise

Return true if the app contain GPS points, false otherwise

Returns
TypeDescription
Promise

An Angular Promise where the success method will be called with a boolean argument indicating if the app contain GPS points (true) or not (false)

openURLInInternalBrowser (url)

Will open an url with the PixLive SDK internal browser

Parameters
NameTypeDescription
url string

The url

presentNotificationsList -> boolean

Display the PixLive SDK notification list over the Ionic app. If no notification is available, the call fails and return false.

Returns
TypeDescription
boolean

True if the method was able to show the list (i.e. if the list is not empty), false otherwise.

removeBookmark (contextId)

Remove a context from the bookmark list.

Parameters
NameTypeDescription
contextId string

the ID (from the pixlive.Context#contextId property of the Context object) of the context to remove from the bookmark list