Periyodik konum güncellemeleri almak için Smart Location Library numaralı telefonu kullanmaya çalışıyorum. Ancak süreci başlattığınızda dinleyiciyi bir kez ateşler, daha sonra başka güncelleme olmaz. İşte ben Akıllı Konum Kitaplığı'nı kullanırken karşılaşılan sorunlar
public void startTracking(View v) {
provider = new LocationGooglePlayServicesWithFallbackProvider(this);
Log.i("Tag","Start Tracking");
SmartLocation smartLocation = new SmartLocation.Builder(this)
.logging(true)
.build();
smartLocation.location(provider)
.config(LocationParams.BEST_EFFORT)
.start(this);
smartLocation.activity().start(this);
}
public void stopTracking(View v) {
Log.i("Tag","Stop Tracking");
SmartLocation.with(this).location().stop();
SmartLocation.with(this).activity().stop();
}
@Override
public void onActivityUpdated(DetectedActivity detectedActivity)
{
Log.i("Tag","ActivityUpdate : "+detectedActivity.toString());
}
@Override
public void onLocationUpdated(Location location)
{
Log.i("Tag","LocationUpdate : "+location.getLatitude()+","+location.getLongitude());
}
Bu
kullanılan kod, Sonra artık değerler i StartButton basın taktirde bu otomatik verilir ben01-27 14:09:01.791 3038-3038/com.angulusits.smartlocationtest I/Tag:
Start Tracking
01-27 14:09:01.879 3038-3038/com.angulusits.smartlocationtest I/Tag:
ActivityUpdate : DetectedActivity [type=STILL, confidence=100]
01-27 14:09:02.017 3038-3038/com.angulusits.smartlocationtest I/Tag:
LocationUpdate : <some-value>,<some-value>
var Logcat çıkıştır.
public static final LocationParams BEST_EFFORT = new Builder().setAccuracy(LocationAccuracy.MEDIUM).setDistance(150).setInterval(2500).build();
Yani cihaz hareketli olmasa bile güncellemeleri her
2500 mili saniye beklenen:
I BEST_EFFORT değeri için Kitaplığı kodunu kontrol etti. Eğer birisi beni doğru yönde gösterebilirse sevinirim.
Ben de aynı sorunu yaşıyorum. onLocationUpdated, başlatmayı başlattığımda ancak bundan sonra hiçbir güncelleme yapılmadığında bir kez çağırıyor. herhangi bir cevap için teşekkürler – kiruba