Hi from the title itself, please see below the specific requirements
of the android app that i'm preparing:

GPS android app which runs on the background checking its position
(LAT and LONG)
App will be used in a car, once the car enters a specified 1 km road
(almost straight 4 lane road or freeway), it will automatically send
its LAT, LONG and timestamp only to a server via 3G/HSPDA every
second.
Once it exit the specified 1 km road the app automatically stop
sending coordinates and timestamp to server.
I'm just starting to appreciate android programming and i think i was
able to find the code for the 1st requirement already using the one
below. For the 2nd and 3rd requirement i was reading about proximity
but it's concerned only on the distance from a certain point (radius)
and not on a rectangular area. Please help on the next coding step and
decisions that i will do and please also post some links about the
options so that i can study them since i'm just a new learner. My
gratitude.


import android.os.Bundle;
import android.widget.Toast;

// request location updates method

public class GpsActivity extends Activity {
private LocationManager lm;
private LocationListener locationListener;

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

lm = (LocationManager)getSystemService(Context.LOCATION_SERVICE);

locationListener = new MyLocationListener();

lm.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0,
locationListener);


//OPTIONAL

//Criteria criteria = new Criteria();
//criteria.setAccuracy(Criteria.ACCURACY_FINE);
//criteria.setAltitudeRequired(false);
//criteria.setBearingRequired(false);
//criteria.setCostAllowed(true);
//criteria.setPowerRequirement(Criteria.POWER_LOW);
//String provider = locationManager.getBestProvider(criteria, true);

}
private class MyLocationListener implements LocationListener{

    @Override
    public void onLocationChanged(Location location) {
        if (location != null){
            Toast.makeText(getBaseContext(), "Location changed : Lat:
" + location.getLatitude()+
                    " Long: " + location.getLongitude(),
Toast.LENGTH_SHORT).show();
        }

    }

    @Override
    public void onProviderDisabled(String provider) {
        // TODO Auto-generated method stub

    }

    @Override
    public void onProviderEnabled(String provider) {
        // TODO Auto-generated method stub

    }

    @Override
    public void onStatusChanged(String provider, int status, Bundle
extras) {
        // TODO Auto-generated method stub

    }

}
}

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to