Android examples for Map:Location Provider
Requests updates for the provided listener in the LocationManager , asking for updates from specific providers .
//package com.java2s; import android.content.Context; import android.location.LocationListener; import android.location.LocationManager; public class Main { /**//from w ww. j a v a 2 s . com * Requests updates for the provided {@code listener} in the {@link LocationManager}, asking for updates from * specific {@code providers}. */ public static void register(Context context, LocationListener listener, String[] providers) { final LocationManager locationManager = (LocationManager) context .getSystemService(Context.LOCATION_SERVICE); for (String provider : providers) { locationManager.requestLocationUpdates( LocationManager.GPS_PROVIDER, 0, 0, listener); } } }