how to get exact latitude longitude fromandroid studio
@SuppressLint("MissingPermission")
private void getLastLocation(){
if (checkPermissions()) {
if (isLocationEnabled()) {
mFusedLocationClient.getLastLocation().addOnCompleteListener(
new OnCompleteListener<Location>() {
@Override
public void onComplete(@NonNull Task<Location> task) {
Location location = task.getResult();
if (location == null) {
requestNewLocationData();
} else {
latTextView.setText(location.getLatitude()+"");
lonTextView.setText(location.getLongitude()+"");
}
}
}
);
} else {
Toast.makeText(this, "Turn on location", Toast.LENGTH_LONG).show();
Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
startActivity(intent);
}
} else {
requestPermissions();
}
}
Also in C++:
- ubuntu fingerprint sudo
- shell script to check the directory exists
- connectify alternative for linux
- update composer on windows
- command prompt change directory to network drive
- accept only numbers regex
- how to install cargo crate
- add-apt-repository command not found
- vim move to the last line you edited
- uninstall package with pip
- ingnore large files in github
- how to activate virtual environment using ubuntu
- linux shell check if directory does not exists
- how to check for angular cli version
- brew install npm
- git push rejected
- 'webpack-dev-server' is not recognized as an internal or external command
- mac check shell version
- git clone submodules
- installing git on ec2
- bash list process on port
- pip install covid
- linux psql
- How to Create Files in Linux