LocationClient sınıfının şu anda kullanımdan kaldırıldığını fark ettim. Bir seyahat uygulaması için kullanıyordum. ve ben LocationClient yerine LocationServices kullanma mantığı değiştirdi: https://developer.android.com/reference/com/google/android/gms/location/LocationServices.htmlgetTriggeringGeofences ve getGeofenceTransition from LocationServices
Şimdi problem ben LocationServices.Geofence veya GoogleApiClient gelen getTriggeringGeofences ve getGeofenceTransition alamayan olduğunu. Bunu nasıl yaparım?
Bu
benim eski BroadcastReceiver gelen kodudur:int transitionType = LocationClient.getGeofenceTransition(intent);
if(transitionType == Geofence.GEOFENCE_TRANSITION_EXIT) {
List<Geofence> triggerList = LocationClient.getTriggeringGeofences(intent);
for (Geofence geofence : triggerList) {
Log.i("", "geof: " + transitionType + " GPS zone " + geofence.getRequestId());
if(geofence.getRequestId().contentEquals("1")) {
Utils.appendLog("GEOFENCE: exited current position GPS Zone");
MyApp.getInstance().disableGeofence();
addLoc();
}
}
}else if (transitionType == Geofence.GEOFENCE_TRANSITION_ENTER){
List<Geofence> triggerList = LocationClient.getTriggeringGeofences(intent);
for (Geofence geofence : triggerList) {
Log.i("", "geof: " + transitionType + " GPS zone " + geofence.getRequestId());
if(geofence.getRequestId().contentEquals("2")) {
Utils.appendLog("GEOFENCE: entered destination position GPS Zone");
MyApp.getInstance().disableGeofence();
}
}
}else{
Log.e("", "Geofence transition error: " + transitionType);
}
kesinlikle hiçbir örnek yoktur Kullanımdan kaldırılan çitler, kullanımdan kaldırılan LocationClient kullanmadan: Ben bulduğum belgelere en yakın olan bu https://github.com/jdellinger/AnDevConNov2014-LocationServicesDemoProject/tree/newapi - ama hala çit tetikleyicileri almak için LocationClient kullanır – InquisitorJax