-2
我做了GPS位置侦听器,但我的位置更新需要权限?我做了gps位置侦听器,但我的位置更新需要权限?
public abstract class MapsActivity extends FragmentActivity implements GoogleApiClient.ConnectionCallbacks,GoogleApiClient.OnConnectionFailedListener {
protected GoogleApiClient mGoogleApiClient;
protected Location mLastLocation;
private GoogleMap mMap;
private LocationManager mng;
private TextView txt1, txt2;
private LocationListener receiver;
private void init() {
mng = (LocationManager)
this.getSystemService(Context.LOCATION_SERVICE);
mng.requestLocationUpdates(LocationManager.GPS_PROVIDER, 1000L, 1.0F, receiver);
}
我尝试了十几次,但最终没有工作ı获得权限错误 –
如果您添加运行时权限,如果您添加清单权限,则代码中的某些内容不正确... @AydınVardar –