最近,我创建了一个简单的应用程序来获取gps位置并在Android手机上显示.开始时,我可以在几次尝试后获取位置,但在重新安装apk文件后,getLastKnownLocation()始终返回空值.
使用的开发环境: - API 10姜饼2.3.6 - 使用GPS提供商
下面是我在我的android项目中应用的代码:
public class MyActivity extends MapActivity{
protected void onCreate(Bundle savedInstanceState) {
mapView = (MapView)findViewById(R.id.myTripMap);
mapController = mapView.getController();
mapView.setSatellite(false);
mapView.setStreetView(true);
mapView.displayZoomControls(false);
mapView.setBuiltInZoomControls(true);//
mapView.setClickable(true);
mapController.setZoom(14);
Criteria criteria = new Criteria();
criteria.setAccuracy(Criteria.ACCURACY_FINE);
criteria.setAltitudeRequired(false);
criteria.setBearingRequired(false);
criteria.setCostAllowed(true);
criteria.setPowerRequirement(Criteria.POWER_LOW);
provider = locationManager.getBestProvider(criteria, true);
location = locationManager.getLastKnownLocation(provider);
updateMyCurrentLoc(location);
locationManager.requestLocationUpdates(provider, 2, 1,locationListener);
}
private final LocationListener locationListener = new LocationListener() {
public void onLocationChanged(Location location) {
updateMyCurrentLoc(location);
}
public void onProviderDisabled(String provider){
updateMyCurrentLoc(null);
}
public void onProviderEnabled(String provider){ }
public void …
Run Code Online (Sandbox Code Playgroud) 任何人都可以提供任何显示如何绘制此类条件的链接吗?
实际上我在我的android项目中从JSON获取了图像字符串.字符串图像成功传递给使用HTTPPOST.现在,我面临的问题是在php中的mysql数据库中将图像保存为blob类型.如何转换我得到的字符串图像,以便它可以保存为mysql数据库中的blob类型?如果有人知道的方式,请善意的建议.
谢谢.