Javascript 离子2电流位置不';如果不返回任何东西,它就会在Android设备上超时

Javascript 离子2电流位置不';如果不返回任何东西,它就会在Android设备上超时,javascript,google-maps,location,ionic2,Javascript,Google Maps,Location,Ionic2,当我启动应用程序,然后按下位置上的用户开关时,离子2当前位置不会返回任何位置。一旦用户打开GPS并单击重试按钮以获取用户的位置,getcurrent user location不会返回任何位置。然而,当gps打开时,我启动了所有的程序 我还检查是否首先启用了位置,然后尝试获取当前位置。你知道为什么会这样吗 Diagnostic.isLocationEnabled().then( bool =>{ if( bool == false ){

当我启动应用程序,然后按下位置上的用户开关时,离子2当前位置不会返回任何位置。一旦用户打开GPS并单击重试按钮以获取用户的位置,getcurrent user location不会返回任何位置。然而,当gps打开时,我启动了所有的程序

我还检查是否首先启用了位置,然后尝试获取当前位置。你知道为什么会这样吗

        Diagnostic.isLocationEnabled().then( bool =>{
            if( bool == false ){
              console.log("location is disbaled")
            }
            else{

                Geolocation.getCurrentPosition(options).then((position) => {

                  this.usersLocation = {
                            lat: position.coords.latitude, 
                            lng: position.coords.longitude
                        };

                  console.log('user location', this.usersLocation);                                                

                }).catch((error) => {

                    console.log('falling back to deafult user location', 
                    this.usersLocation);                                                

                });                                       
            }
        });

尝试将错误回调放到
isLocationEnabled()。然后()
一旦GPS打开,isLocationEnabled工作并返回true,但是getCurrentPosition默认为catch部分,没有错误。这是我拥有的选项变量:let options={timeout:10000,enableHighAccurance:true}我只是仔细检查了一下,得到了这个错误:“代码3:timeout expired”。尝试插入此调用
Diagnostic.isLocationEnabled()。然后在
this.platform.ready()中插入
。然后(()=>{})
谢谢,但还是一样的。也许我应该重新初始化爱奥尼亚那边的gps?我该怎么做?