我看的是雷达城的例子:
http://code.google.com/p/andengineexamples/source/browse/src/org/anddev/andengine/examples/app/cityradar/CityRadarActivity.java?r=dea4a6fe72f983821ddbc287cfb90a8562f4b433
我已经实现了ILocationListener并启用了位置传感器,还通过onResume方法启用了位置传感器:
@Override
protected synchronized void onResume()
{
super.onResume();
System.gc();
final LocationSensorOptions locationSensorOptions = new LocationSensorOptions();
locationSensorOptions.setAccuracy(Criteria.ACCURACY_COARSE);
locationSensorOptions.setMinimumTriggerTime(0);
locationSensorOptions.setMinimumTriggerDistance(0);
this.enableLocationSensor(this, locationSensorOptions);
}然后尝试通过实现的方法来改变位置上的位置
@Override
public void onLocationChanged(Location plocation) {
this.mUserLocation = plocation;
curlng = mUserLocation.getLongitude();
curlat = mUserLocation.getLatitude();
}但我只得到了0,我有点困惑,我不知道是使用内置的位置传感器和引擎还是使用android原生位置传感器?
发布于 2013-06-03 18:03:48
它使用Android位置传感器。
有几件事你应该检查一下:
ACCESS_FINE_LOCATION和ACCESS_COARSE_LOCATION权限?除非你发布你的Logcat输出,否则不可能给出确切的答案。
https://stackoverflow.com/questions/16317202
复制相似问题