起步软件技术论坛
搜索
 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 3994|回复: 1

[处理中3] 为什么定位输出经纬度第一次成功,后面失败,ak和安全码...

[复制链接]

88

主题

266

帖子

584

积分

高级会员

Rank: 4

积分
584
QQ
发表于 2018-9-28 16:09:41 | 显示全部楼层 |阅读模式
Model.prototype.modelLoad = function(event){
               
                var id, target, option;

                function success(pos) {
                  var crd = pos.coords;
                  console.log("pos:"+pos);
                  console.log("crd:"+crd);
                  console.log("crd.latitude:"+crd.latitude);
                  console.log("crd.longitude:"+crd.longitude);
                  if (target.latitude === crd.latitude && target.longitude === crd.longitude) {
                          alert("crd.latitude:"+crd.latitude);
                          console.log("crd.latitude:"+crd.latitude);
                          console.log("crd.longitude:"+crd.longitude);
                    console.log('Congratulation, you reach the target');
                    navigator.geolocation.clearWatch(id);
                  }
                };

                function error(err) {
                  console.warn('ERROR(' + err.code + '): ' + err.message);
                };

                target = {
                  latitude : 0,
                  longitude: 0,
                }

                options = {
                  enableHighAccuracy: false,
                  timeout: 5000,
                  maximumAge: 0
                };

                id = navigator.geolocation.watchPosition(success, error, options);
                               
        };






91

主题

13万

帖子

3万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
36198
发表于 2018-9-28 17:12:53 | 显示全部楼层
这个是需要自己获取百度app的SDK的,每次获取后停止监听了吗?
/UI2/demo/native/geolocation/mainActivity.w
远程的联系方法QQ1392416607,添加好友时,需在备注里注明其论坛名字及ID,公司等信息
发远程时同时也发一下帖子地址,方便了解要解决的问题  WeX5教程  WeX5下载



如按照该方法解决,请及时跟帖,便于版主结贴
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|X3技术论坛|Justep Inc.    

GMT+8, 2025-8-28 01:46 , Processed in 0.082842 second(s), 23 queries .

Powered by Discuz! X3.4

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表