我的 appwidget 获取位置以获取预测。作为标题,系统重新启动后无法获取位置。
LocationManager lm = (LocationManager)mContext.getSystemService(Context.LOCATION_SERVICE);
Criteria criteria = new Criteria();
criteria.setBearingRequired(false);
criteria.setSpeedRequired(false);
criteria.setAltitudeRequired(false);
String provider = lm.getBestProvider(criteria, true);
Location loc = lm.getLastKnownLocation(provider);
double lat = loc.getLatitude(); //null
double lon = loc.getLongitude();/null
为什么这些在系统重新启动后为空?