Android examples for Map:Address
get Gps Address
//package com.java2s; import android.content.Context; import android.location.Criteria; import android.location.Location; import android.location.LocationManager; import android.widget.Toast; public class Main { private static Context mContext; private static LocationManager locationManager; public static String getGpsAddress(Context context) { locationManager = (LocationManager) context .getSystemService(Context.LOCATION_SERVICE); Criteria criteria = new Criteria(); criteria.setCostAllowed(false);/*from w w w .j ava2s. c o m*/ criteria.setAccuracy(Criteria.ACCURACY_COARSE); String providerName = locationManager.getBestProvider(criteria, true); if (providerName != null) { Location location = locationManager .getLastKnownLocation(providerName); if (location != null) return location.getLatitude() + ";" + location.getLongitude() + ";" + location.getAltitude(); } else { Toast.makeText(mContext, "1.? \n2.", Toast.LENGTH_SHORT).show(); } return null; } }