Possible Duplicate:
What is the simplest and most robust way to get the user’s current location in Android?
I have the following code that opens up Google Maps on the phone and passes the longitude + latitude of the destination and start location to it. I was wondering though if there was a way so that instead of having to manually enter a starting location into the code, if we could instead somehow get the code to automatically find out where the user is?
add.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View arg0) {
        // TODO Auto-generated method stub
        Intent intent = new Intent (android.content.Intent.ACTION_VIEW,
            Uri.parse("http://maps.google.com/maps?saddr=" + 51.5171 +
                      "," + 0.1062 + "&daddr=" + 52.6342 + "," + 1.1385));
        intent.setComponent(
            new ComponentName ("com.google.android.apps.maps",
                               "com.google.android.maps.MapsActivity"));
        startActivity(intent);
    }
});
 
     
     
     
    