native-interaction
与途虎IOS与Android客户端交互方法
var native = require('@tuhu/native-interaction')
native.getUserInfo().then(res => {
console.log('res: ', res);
})
native.getDevice().then(res => {
console.log('res: ', res);
})
native.getLocation().then(res => {
console.log('res: ', res);
})
方法名 | 参数 | 返回值 | 方法说明 |
---|
getUserInfo | - | 返回值1 | 获取用户信息 |
getDevice | - | 返回值2 | 获取用户设备信息 |
getLocation | - | 返回值3 | 获取地理位置信息 |
返回值1
{
islogin: true,
userid: "2c17639a-a05b-46ac-966b-123b15b644cb",
phone: "17621373772",
name: "lijingwen@tuhu.cn",
usersession: "8e75f4015a8b4931829fe0f7de7b8dee"
}
返回值2
row 字段为返回的原始值
{
"blackBox":"eyJvcyI6ImFuZHJvaWQiLCJ2ZXJzaW9uIjoiMy4xLjEiLCJwYWNrYWdlcyI6ImNuLlR1SHUuYW5kcm9pZF81LjEuMCIsInByb2ZpbGVfdGltZSI6MTkyLCJpbnRlcnZhbF90aW1lIjozODIzODQsInRva2VuX2lkIjoiblNKT1NiazdNMXZxaForejJWRHdGSjkzanQ0SGl1RFdHQU4xOGdONm54ZWZPZlhmYVVEc3ZLRDBcLzFJSnE5dmk3ZnE1KzVlMHlEYXNHRW1hc3NMRGhnPT0ifQ==",
"deviceId":"d8bd90d4-9c0a-3d81-815e-e91cbbfb11bf",
"deviceModel":"_yuzhuang4",
"deviceType":"NX511J",
"deviceCarrier":"Unknown",
"isGpsEnabled":true,
"isNotifyEnabled":"",
"lang":"zh",
"model":"NX511J",
"osName":"nubia",
"osVersion":"5.1.1",
"version":"5.1.0",
"netWork":"wifi",
"raw":{
"device_type":"NX511J",
"is_notify_enabled":false,
"city":"上海市",
"client_time":1509444370,
"event_type":"get_info",
"app_id":"android_app",
"screen_resolution":"1920x1080",
"app_name":"途虎养车",
"network":"wifi",
"is_gps_enabled":true,
"device_carrier":"Unknown",
"app_version":"5.1.0",
"country":"CN",
"device_id":"d8bd90d4-9c0a-3d81-815e-e91cbbfb11bf",
"event_action":"get_info",
"imei":"9261d262c97215531d7a9a26cba000e5",
"location":"31.135892,121.403088",
"lang":"zh",
"device_model":"NX511J",
"os_version":"5.1.1",
"metadata":"{\"Source\":\"_yuzhuang4\"}",
"level":"info",
"os_name":"nubia",
"deviceid":"d8bd90d4-9c0a-3d81-815e-e91cbbfb11bf",
"blackbox":"eyJvcyI6ImFuZHJvaWQiLCJ2ZXJzaW9uIjoiMy4xLjEiLCJwYWNrYWdlcyI6ImNuLlR1SHUuYW5kcm9pZF81LjEuMCIsInByb2ZpbGVfdGltZSI6MTkyLCJpbnRlcnZhbF90aW1lIjozODIzODQsInRva2VuX2lkIjoiblNKT1NiazdNMXZxaForejJWRHdGSjkzanQ0SGl1RFdHQU4xOGdONm54ZWZPZlhmYVVEc3ZLRDBcLzFJSnE5dmk3ZnE1KzVlMHlEYXNHRW1hc3NMRGhnPT0ifQ==",
"channel":"_yuzhuang4"
}
}
字段含义
字段 | 类型 | 描述 |
---|
blackBox | String | 同盾黑盒子设备指纹 |
deviceId | String | 设备号 |
deviceModel | String | 设备类型 |
deviceType | String | 设备名称 |
deviceCarrier | String | 网络运营商名 |
isGpsEnabled | Bool | 定位是否开启 |
isNotifyEnabled | Bool | 通知是否开启 |
lang | String | 系统语言 |
model | String | 设备型号 |
osName | String | 系统名称 |
osVersion | String | 系统版本号 |
version | String | App版本号 |
netWork | String | 网络状态 |
raw | Object | 原生返回的所有数据,以上所有内容都包括在内 |
raw字段含义
详情参见IOS 交互文档
字段 | 类型 | 描述 |
---|
version | String | App版本号 |
UDID | String | 设备号 |
province | String | 所选省份(首页可修改,默认取定位省份) |
city | String | 所选城市(首页可修改,默认取定位城市) |
district | String | 所选区(首页可修改,默认取定位区) |
latitude | Double | 定位纬度 |
longitude | Double | 定位经度 |
blackBox | String | 同盾黑盒子设备指纹 |
is_gps_enabled | Bool | 定位是否开启 |
is_notify_enabled | Bool | 通知是否开启 |
screen_resolution | String | 屏幕分辨率(逻辑像素) |
os_name | String | 系统名称 |
os_version | String | 系统版本号 |
device_carrier | String | 网络运营商名 |
device_model | String | 设备类型 |
device_type | String | 设备名称 |
lang | String | 系统语言 |
country | String | 系统设置国家 |
location | String | 位置(经纬度) |
network_status | String | 网络状态 |
model | String | 设备型号 |
返回值3
{
"city":"上海市",
"district":"闵行区",
"info":"中国上海市闵行区万源路18号-1",
"latitude":"31.136137",
"longitude":"121.40296",
"province":"上海市"
}