Код: Выделить всё
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button buttonGps = findViewById(R.id.buttonGps);
final Context activity = this;
buttonGps.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (!checkForPhonePermission()) {
return;
}
LocationManager locationManager = (LocationManager) activity.getSystemService(Context.LOCATION_SERVICE);
locationManager.requestSingleUpdate(LocationManager.GPS_PROVIDER, new LocationListener() {
@Override
public void onLocationChanged(@NonNull Location location) {
Log.d(TAG, location.getLatitude() + "");
}
}, Looper.myLooper());
}
});
}
Код: Выделить всё
java.lang.AbstractMethodError: abstract method "void android.location.LocationListener.onStatusChanged(java.lang.String, int, android.os.Bundle)"
Код: Выделить всё
java.lang.AbstractMethodError: abstract method "void android.location.LocationListener.onProviderDisabled(java.lang.String)"
В документации эти методы помечены по умолчанию, поэтому мне не нужно их реализовывать.
Есть ли причина такого поведения? ?
Подробнее здесь: https://stackoverflow.com/questions/646 ... nproviderd