0
Google 유리 라이브 카드에서 사용자의 속도를 표시하려고합니다. 위도와 경도를 얻을 수 있지만 getSpeed ()는 항상 0.0을 반환합니다. 나는 SO에 관해서 비슷한 질문을했지만 아무런 도움이되지 않았다.Google Glass-GDK 앱 getSpeed ()가 0.0을 반환합니다.
여기에만 setSpeed를 호출하는 공급자로부터 getSpeed 수 있습니다 내 코드
Criteria criteria = new Criteria();
criteria.setAccuracy(Criteria.ACCURACY_FINE);
LocationManager mLocationManager = (LocationManager) getSystemService(LOCATION_SERVICE);
String provider = mLocationManager.getBestProvider(criteria, true);
boolean isEnabled = mLocationManager.isProviderEnabled(provider);
if (isEnabled) {
// Define a listener that responds to location updates
LocationListener locationListener = new LocationListener() {
@Override
public void onLocationChanged(Location location) {
// Called when a new location is found by the network location provider.
if (location != null) {
Geocoder geocoder = new Geocoder(Start_service.this.getBaseContext(), Locale.getDefault());
// lat,lng, your current location
List<Address> addresses = null;
try {
lati= location.getLatitude();
longi=location.getLongitude();
speed=location.getSpeed();
addresses = geocoder.getFromLocation(location.getLatitude(), location.getLongitude(), 1);
}
catch (IOException e) {
System.out.println(e);
e.printStackTrace();
}
기준을 설정하더라도 속도가 0을 반환합니다. 단서가 있습니까? –
음, 잘 모르겠습니다. 아마도 GDK의 버그 일 것입니다. 아직 베타 버전이므로 잠시 기다려주십시오. – pt2121