Code example for Location

Methods: setProvidersetTime

0
    @Override 
    public void start() {         
        // get last known location 
        Location loc = manager.getLastKnownLocation(LocationManager.GPS_PROVIDER);
        if (loc != null) {
            loc.setProvider(LocationManager.NETWORK_PROVIDER);
            loc.setTime(System.currentTimeMillis());
            onLocationChanged(loc);
        } 
        // Track first good location 
        marker.setTrackingEnabled(true);
        // Register for location updates 
        manager.requestLocationUpdates(LocationManager.GPS_PROVIDER, UP_IDLE, UP_DIST,
                GpsProvider.this);
        manager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, UP_ACTIVE, UP_DIST,
                GpsProvider.this);
    } 
 
    @Override 
    public void quit() { 
        status = STATUS_CONNECTION_LOST;