FileDocCategorySizeDatePackage
TestLocationProvider.javaAPI DocAndroid 1.5 API3325Wed May 06 22:42:02 BST 2009android.test

TestLocationProvider

public class TestLocationProvider extends android.location.LocationProviderImpl
hide
- This is part of a framework that is under development and should not be used for active development.

Fields Summary
public static final String
PROVIDER_NAME
public static final double
LAT
public static final double
LON
public static final double
ALTITUDE
public static final float
SPEED
public static final float
BEARING
public static final int
STATUS
private android.location.Location
mLocation
private boolean
mEnabled
Constructors Summary
public TestLocationProvider()


      
        super(PROVIDER_NAME);
        mLocation = new Location(PROVIDER_NAME);
        updateLocation();
    
Methods Summary
public voiddisable()

        mEnabled = false;
    
public voidenable()

        mEnabled = true;
    
public intgetAccuracy()

        return Criteria.ACCURACY_COARSE;
    
public booleangetLocation(android.location.Location l)

        updateLocation();
        l.set(mLocation);
        return true;
    
public intgetPowerRequirement()

        return Criteria.NO_REQUIREMENT;
    
public intgetStatus(android.os.Bundle extras)

        return STATUS;
    
public booleanhasMonetaryCost()

        return false;
    
public booleanisEnabled()

        return mEnabled;
    
public booleanrequiresCell()

        return false;
    
public booleanrequiresNetwork()

        return false;
    
public booleanrequiresSatellite()

        return false;
    
public booleansupportsAltitude()

        return true;
    
public booleansupportsBearing()

        return true;
    
public booleansupportsSpeed()

        return true;
    
private voidupdateLocation()

        long time = SystemClock.uptimeMillis();
        long multiplier = (time/5000)%500000;
        mLocation.setLatitude(LAT*multiplier);
        mLocation.setLongitude(LON*multiplier);
        mLocation.setAltitude(ALTITUDE);
        mLocation.setSpeed(SPEED);
        mLocation.setBearing(BEARING*multiplier);

        Bundle extras = new Bundle();
        extras.putInt("extraTest", 24);
        mLocation.setExtras(extras);
        mLocation.setTime(time);