所声称的融合定位提供商的API位置更新不工作室内 [英] Location updates not working indoors as claimed by Fusion Location Provider APIs

查看:232
本文介绍了所声称的融合定位提供商的API位置更新不工作室内的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题:

位置更新不工作室内所声称的融合定位提供商的API。

发生了什么:

  1. 在我试图采用最新位置API使用以获得位置更新 LocationClient 在我的Andr​​oid应用程序。
  2. 在我的Andr​​oid应用程序正常工作与任何问题,而我测试室外。
  3. 但在室内测试(在任何建筑物)时,则没有位置更新发生。

预期的行为:

根据新的API,我期待得到一些估计位置周围的建筑,而我是在室内(如GPS没有找到卫星信号,精确定位)。

我看到最新的谷歌地图Android应用程序正常工作室内与估计的位置。

问:

还有什么我必须使用新的位置的API来获取位置更新室内(不需要精确定位,准确度低也无妨)。为了照顾

我使用的是Android 4.2.2版本的API实现Android应用程序。我正在测试的HTC One X(OS v 4.1.1)

下面是我申请使用的位置更新新的API来获取Android code:

步骤1:

  mLocationClient =新LocationClient(这,这,这一点);
 

第二步:

  //创建LocationRequest对象
mLocationRequest = LocationRequest.create();
//使用高精度
mLocationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
//设置更新间隔为5秒
mLocationRequest.setInterval(更新周期​​);
//设置最快的更新间隔为1秒
mLocationRequest.setFastestInterval(FASTEST_INTERVAL);
 

第三步:在 ONSTART()方法 - 以下行添加:

  //连接的客户端。
mLocationClient.connect();
 

第四步:在 onConnected()方法 - 以下行添加:

  mLocationClient.requestLocationUpdates(mLocationRequest,这一点);
 

第五步:在 onLocationChanged()方法 - 监听位置更新。测试的内心时,此方法不叫。这种方法获取调用只有当GPS信号被发现。

 双纬度= location.getLatitude();
双LNG = location.getLongitude();
 

最后加入下面的Andr​​oid清单的权限:

 <使用-权限的Andr​​oid:名称=android.permission.ACCESS_COARSE_LOCATION/>
 <使用-权限的Andr​​oid:名称=android.permission.ACCESS_FINE_LOCATION/>
 

解决方案

经过长期的测试和调试的HTC One X的(4.1.1),我决定尝试在任何其他手机型号相同的测试用例。幸运的是我的朋友的三星S3(4.1.1)进行测试时,我的应用程序在室内工作过。在同一时间和地点,当我跟我的HTC One X的测试,我没有得到位置室内。这两款手机都设置相同的设置(WIFI / GPS /移动网络中的所有已启用)。

要确认这是一个问题与特定的设备,我进行的建设的各个角落里多次试验使用我的应用程序,我看到我的HTC同样的问题在所有室内场所(但在相同的位置S3得到的室内定位)

Issue:

Location updates not working indoors as claimed by Fusion Location Provider APIs.

What happened:

  1. I tried implementing the latest location API to get location updates using LocationClient in my Android App.
  2. My android app works fine with out any issue while I am testing outdoor.
  3. But when testing indoors (inside any building), then no location updates are happening.

Expected behavior:

As per the new APIs, I am expecting to get some estimated location around the building while I am indoors (as GPS do not find the satellite signal for accurate location).

I see that latest Google Maps android app works fine indoors with estimated location.

Question:

What else do I have to take care using new location APIs to get the location update indoors (accurate location is not required, low accuracy is also fine).

I am implementing the Android App using Android 4.2.2 version APIs. I am testing on HTC One X (OS v 4.1.1)

Below is the android code that I applied to get location updates using new APIs:

Step1:

mLocationClient = new LocationClient(this, this, this);

Step2:

// Create the LocationRequest object
mLocationRequest = LocationRequest.create();
// Use high accuracy
mLocationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
// Set the update interval to 5 seconds
mLocationRequest.setInterval(UPDATE_INTERVAL);
// Set the fastest update interval to 1 second
mLocationRequest.setFastestInterval(FASTEST_INTERVAL);

Step3: inside onStart() method - below line is added:

// Connect the client.
mLocationClient.connect();

Step4: inside onConnected() method - below line is added:

mLocationClient.requestLocationUpdates(mLocationRequest, this);

Step5: inside onLocationChanged() method - listening for location updates. This method is not called when testing insides. This method is getting called only when GPS signal is found.

double lat = location.getLatitude();
double lng = location.getLongitude();

Finally added below permissions in Android Manifest:

 <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
 <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

解决方案

After long testing and debugging on HTC One X (4.1.1), I decided to try same test cases on any other phone model. Luckily my app worked indoors too when testing with my friend's Samsung S3 (4.1.1). At same time and location, when I tested with my HTC One X, I do not get location indoors. Both phones are set with same settings (WiFi/GPS/Mobile network all enabled).

To confirm this is an issue with specific device, I performed many tests inside the building at different corners using my app and I see the same issue on my HTC at all indoor locations (but at same locations S3 gets the indoor location).

这篇关于所声称的融合定位提供商的API位置更新不工作室内的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆