API
Class

cordova-plugin-device-orientation (cordova-plugin-device-orientation)

使用范围:Native

Contents

class cordova-plugin-device-orientation (cordova-plugin-device-orientation)

指南针插件

Constructor Top

  cordova-plugin-device-orientation ()

Static Methods Top

void clearWatch (String watchId)
void getCurrentHeading (Function successCallback, Function errorCallback, CompassOptions options)
String watchHeading (Function successCallback, Function errorCallback, HeadingOptions options)

Constructor details Top

public cordova-plugin-device-orientation ()

指南针插件

Static Methods Detail Top

static public void clearWatch (String watchId)

停止监听

Parameters

String watchId

Compass.watchHeading返回的指南针区域标识

Return Value

void

static public void getCurrentHeading (Function successCallback, Function errorCallback, CompassOptions options)

获取当前的指南针

See cordova-plugin-device-orientation.CompassHeading

See cordova-plugin-device-orientation.CompassError

Parameters

Function successCallback

请求成功的回调,返回cordova-plugin-device-orientation.CompassHeading对象

Function errorCallback

请求失败的回调,返回cordova-plugin-device-orientation.CompassError对象

CompassOptions options

请求数据的参数(not use)

Return Value

void

static public String watchHeading (Function successCallback, Function errorCallback, HeadingOptions options)

监听指南针方向

See cordova-plugin-device-orientation.CompassHeading

See cordova-plugin-device-orientation.CompassError

Parameters

Function successCallback

请求成功的回调,返回cordova-plugin-device-orientation.CompassHeading对象

Function errorCallback

请求失败的回调,返回cordova-plugin-device-orientation.CompassError对象

HeadingOptions options

请求数据的参数
参数结构

{ "frequency":{Number} 频率,单位毫秒,缺省为100 "filter":{Number} 筛选器,当设置此值时,frequency不起作用 }

Return Value

String

指南针区域标识,作为Compass.clearWatch的参数