本文整理汇总了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);
}