本文整理匯總了Java中com.google.android.gms.location.LocationListener.onLocationChanged方法的典型用法代碼示例。如果您正苦於以下問題:Java LocationListener.onLocationChanged方法的具體用法?Java LocationListener.onLocationChanged怎麽用?Java LocationListener.onLocationChanged使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.google.android.gms.location.LocationListener
的用法示例。
在下文中一共展示了LocationListener.onLocationChanged方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onLocationChanged
import com.google.android.gms.location.LocationListener; //導入方法依賴的package包/類
@Override
public void onLocationChanged(Location location) {
lastLocation = location;
LocationListener listener;
for(int i = 0; i < listeners.size(); i++) {
listener = listeners.get(i);
if(listener != null) {
listener.onLocationChanged(location);
}
}
}
示例2: onLocationChanged
import com.google.android.gms.location.LocationListener; //導入方法依賴的package包/類
@Override
public void onLocationChanged(Location location) {
// set current location
currentLocation = location;
// notify listener
for(LocationListener locationListener : locationListeners) {
locationListener.onLocationChanged(location);
}
}
示例3: onLocationChanged
import com.google.android.gms.location.LocationListener; //導入方法依賴的package包/類
@Override
public void onLocationChanged(final Location location) {
AndroidDevicePacket newPacket = new AndroidDevicePacket(deviceId, location);
if (lastSentPacket != null)
if (location.getAccuracy() < Settings.getSetting(Settings.FilterAccuracyThreshold)) {
if (!gpsFilter.NavigationFilterWork(lastSentPacket, newPacket)) {
Log.i("Location received and filtered by GPS filter: " + Helpers.locationToString(location));
return;
}
} else if (!lbsFilter.NavigationFilterWork(lastSentPacket, newPacket)) {
Log.i("Location received and filtered by LBS filter: " + Helpers.locationToString(location));
return;
}
Log.i("Location received and applied: " + Helpers.locationToString(location));
lastSentPacket = newPacket;
this.location = location;
lastLocationTime = SystemClock.elapsedRealtime();
AndroidDevicePacketsSender.Instance.addPacket(newPacket);
for (LocationListener listener : locationListeners)
listener.onLocationChanged(location);
updateNotification();
}
示例4: onLocationChanged
import com.google.android.gms.location.LocationListener; //導入方法依賴的package包/類
@Override
public void onLocationChanged(Location location) {
for (LocationListener listener : mListeners) {
listener.onLocationChanged(location);
}
}
示例5: onLocationChanged
import com.google.android.gms.location.LocationListener; //導入方法依賴的package包/類
@Override
public void onLocationChanged(Location location) {
for (LocationListener listener : locationListeners)
listener.onLocationChanged(location);
}