퓨즈 위치 공급자를 사용하여 응용 프로그램을 개발하고 있습니다. 나는 의심 스럽다. 일정한 간격으로 위치를 얻으려면 requestLocationUpdates()를 사용합니다. 그러나 어느 출처로부터 WIFI 또는 GPS 또는 네트워크 중 하나를 얻을 수 있습니다. 내 앱에서는 Wi-Fi가 켜져있을 때만 일정한 간격으로 위치 정보를 가져옵니다. WiFi가 꺼짐 상태 일 때 위치를 얻을 수 없습니다 (GPS 또는 네트워크를 통해 다른 위치에서 위치 정보를 가져 오는 것으로 가정합니다.) 그러나 위치 정보를 얻지 못하거나 GPS 및 네트워크 용 수신기를 작성해야합니다. 나는 그 문제가 뭔지 모른다. 누구든지 나를 도와 줄 수 있어요.퓨전 위치 공급자에서 안드로이드
그리고 모든 공급 업체 (Wi-Fi, GPS, 네트워크)를 사용할 수있을 때만 작동하는지 여부.
public void checkPlay(){
int resp = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this);
if (resp == ConnectionResult.SUCCESS) {
locationClient = new LocationClient(this, this, this);
locationClient.connect();
} else {
Toast.makeText(this, "Google Play Service Error " + resp,
Toast.LENGTH_LONG).show();
}
}
public void onConnected(Bundle arg0) {
// TODO Auto-generated method stub
if (locationClient != null && locationClient.isConnected()) {
locationRequest = LocationRequest.create();
locationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
locationRequest.setInterval(100);
locationClient.requestLocationUpdates(locationRequest, this);
}
}
public void onLocationChanged(Location location) {
// TODO Auto-generated method stub
try {
if (location != null) {
lat = location.getLatitude();
long = location.getLongitude();
}
} catch (Exception e) {
Log.d(Fots.TAG,
"GpsTrackService.mGpsLocationListener.onLocationChanged", e);
}
}
http://wptrafficanalyzer.in/blog/gps-and-google-map-in-android-applications-series/ – Aravin
위치 업데이트를 테스트하려면 어떻게해야합니까? –
twntee .. 나는 서비스에서 onLocationChanged()를 작성합니다. 앱에 로그인하면 서비스가 시작되어 1 분마다 서비스가 실행되고 'locationRequest.setPriority (LocationRequest.PRIORITY_HIGH_ACCURACY);'를 사용하여 매 5 초마다 위치 업데이트를받습니다. – Raja45