get Actual Location - Android Map

Android examples for Map:Location

Description

get Actual Location

Demo Code


//package com.java2s;

import android.location.Criteria;
import android.location.Location;
import android.location.LocationManager;

public class Main {
    public static Location getActualLocation(LocationManager locationManager) {

        Criteria criteria = new Criteria();
        String provider = locationManager.getBestProvider(criteria, false);
        Location location = locationManager.getLastKnownLocation(provider);

        return location;
    }//from  w w  w . j a v a 2  s.  c om
}

Related Tutorials