API
Class

Geo ($UI/system/api/native/geo)

使用范围:UI2

Contents

class Geo ($UI/system/api/native/geo)

地理信息接口。

 
	 
	 var geo = require('$UI/system/api/native/geo');
	 geo.openLocation({
			latitude : 23.099994,
			longitude : 113.324520,
			name : 'TIT 创意园',
			address : '广州市海珠区新港中路 397 号',
			scale : 14,
			infoUrl : 'http://weixin.qq.com'
		});
	 geo.getLocation({
			success : function(res) {
				alert(JSON.stringify(res));
			},
			cancel : function(res) {
				alert('用户拒绝授权获取地理位置');
			}
		});
	

Constructor Top

  Geo ()

Static Methods Top

void getLocation (Object options)
void openLocation (Object options)

Constructor details Top

public Geo ()

地理信息接口。

 
	 
	 var geo = require('$UI/system/api/native/geo');
	 geo.openLocation({
			latitude : 23.099994,
			longitude : 113.324520,
			name : 'TIT 创意园',
			address : '广州市海珠区新港中路 397 号',
			scale : 14,
			infoUrl : 'http://weixin.qq.com'
		});
	 geo.getLocation({
			success : function(res) {
				alert(JSON.stringify(res));
			},
			cancel : function(res) {
				alert('用户拒绝授权获取地理位置');
			}
		});
	

Static Methods Detail Top

static public void getLocation (Object options)

得到当前的地理位置。

Parameters

Object options

选项
结构如下:

{ "success" : {function} success 回调函数 "cancel" : {function} cancel 回调函数 }

Return Value

void

static public void openLocation (Object options)

打开百度地图。

Parameters

Object options

选项
结构如下:

{ "latitude" : {string} 纬度, "longitude" : {string} 经度, "name" : {string} 名称, "address" : {string} 地址, "scale" : {int} 地图缩放, "infoUrl" : {string} 链接信息 }

Return Value

void