нулевой объект показывают! ест кто посмотреть? GoogleApiClient.ConnectionCallbacks,
GoogleApiClient.OnConnectionFailedListener,
com.google.android.gms.location.LocationListener {
private GoogleMap mMap;
GoogleApiClient googleApiClient;
Location lastLocation;
LocationRequest locationRequest;
private Button LogoutDriverButton, SettingsDriverButton;
private FirebaseAuth mAuth;
private FirebaseUser currentUser;
private Boolean currentLogoutDriverStatus;
@Override protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_drivers_map);
mAuth = FirebaseAuth.getInstance();
currentUser = mAuth.getCurrentUser();
LogoutDriverButton = (Button)findViewById(R.id.driver_logout_button);
SettingsDriverButton = (Button)findViewById(R.id.driver_settings_button);
SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
.findFragmentById(
R.id.map);
mapFragment.getMapAsync(this);
LogoutDriverButton.setOnClickListener(new View.OnClickListener() {
@Override public void onClick(View v) {
currentLogoutDriverStatus = true;
mAuth.signOut();
LogoutDriver();
DisconnectDriver();
}
});
}
@Override public void onMapReady(GoogleMap googleMap) {
mMap = googleMap;
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
return;
}
mMap.setMyLocationEnabled(true);
}
@Override public void onConnected(
@Nullable Bundle bundle) {
locationRequest = new LocationRequest();
locationRequest.setInterval(1000);
locationRequest.setFastestInterval(1000);
locationRequest.setPriority(locationRequest.PRIORITY_HIGH_ACCURACY);
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
return;
}
LocationServices.FusedLocationApi.requestLocationUpdates(googleApiClient, locationRequest, this);
}
@Override public void onConnectionSuspended(int i) {
}
@Override public void onConnectionFailed(
@NonNull ConnectionResult connectionResult) {
}
@Override public void onLocationChanged(Location location)
{
lastLocation = location;
LatLng latLng = new LatLng(location.getLatitude(), location.getAltitude());
mMap.moveCamera(CameraUpdateFactory.newLatLng(latLng));
mMap.animateCamera(CameraUpdateFactory.zoomTo(12));
String userID = FirebaseAuth.getInstance().getCurrentUser().getUid();
DatabaseReference DriversAvailableRef = FirebaseDatabase.getInstance().getReference().child("Driver Available");
GeoFire geoFireAvalablity = new GeoFire(DriversAvailableRef);
geoFireAvalablity.setLocation(userID, new GeoLocation(location.getLatitude(), location.getLongitude()));
}
protected synchronized void buildGoogleApiClient()
{
googleApiClient = new GoogleApiClient.Builder(this)
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.addApi(LocationServices.API)
.build();
googleApiClient.connect();
}
@Overrideprotected void onStop() {
super.onStop();
if (!currentLogoutDriverStatus) {
DisconnectDriver();
}
}
private void DisconnectDriver() {