[android-developers] Re: GPS accuracy problems

2009-02-12 Thread Anna PS

Thanks (again) Ludwig. I've installed the satellite app and will try
it out.

I realise that GPS accuracy is not always great in built-up areas.

However, that doesn't explain why often the Maps application seems to
have good GPS accuracy, but the LocationListener in this application
doesn't - at the same moment in time!

Maybe I do just need to use Skyhook in order to get a reliable GPS
fix.

Anna

On 11 Feb, 18:26, Ludwig ludwigbrinckm...@gmail.com wrote:
 It is notoriously difficult for GPS chips to get a good fix in built-up
 areas. 'Seeing the sky' is a bit loose a formulation: ideally a unit has to
 be able to see five or more satellites and for accuracy purposes they must
 not be all exactly overhead. Furthermore buildings bounce back the signals
 adding to confusion. On a clear mountain top is best, maybe the top of
 Canary Wharf tower.
 That's why there have been different approaches to improve GPS accuracy,
 e.g. triangulation from cell-towers. Skyhook Wireless claim to have a
 library that improves accuracy, apparently newer versions of AndNav use it.
 Other applications assume that you are always on a road and will place you
 on the nearest one.

 I just published a little application that gives you a view of the satellite
 constellation used to derive your location. You can get it 
 here:http://andappstore.com/AndroidPhoneApplications/apps/38257
 http://andappstore.com/AndroidPhoneApplications/apps/38257That
 does not itself improve accuracy, but at least you can get an idea why your
 accuracy is shite..

 Ludwig

 2009/2/11 Anna PS annapowellsm...@googlemail.com



  Hi,

  I'm writing a mapping application. In simple terms, it sends some info
  about the user's current location to a server when the user clicks on
  a button.

  I need the location to be absolutely correct, and when I first started
  to implement LocationListener, I found that it often wasn't. So I've
  used location.getAccuracy() to check the GPS accuracy, and warn the
  user - without submitting the data - if the location isn't accurate
  enough.

  The code is below.

  I've been trying the app outside and find that the accuracy is often
  32m, 64m or even higher, even after 20 or 30 seconds. This is in
  central London, in full view of the sky, on a clear day! I need it to
  be below 10m.

  At the same time, if I open the Maps application while standing in the
  same spot, it shows my GPS location as a blue spot on the map -
  suggesting the listener in Maps has perfect accuracy.

  So what is the problem? Have I implemented the listener/check in the
  wrong way (which feels like the likely explanation), or is it that GPS
  in Android isn't good enough to write mapping applications? Does
  anyone else have experience of this?

  Best,
  Anna

  --

  //cut-down version of code

  public class GPSTest extends Activity {

         /** Called when the activity is first created. */
         private static final String LOG_TAG = GPSTest;

         private Double latitude = 0.0;
         private Double longitude = 0.0;
         private String latString = ;
         private String longString = ;

         //Location items
         LocationManager locationmanager;
         LocationListener listener;
         Location location;
         private float gpsAccuracy;
         private long locationTime;
         private long currentTime;
         private long timeDifference;

         //Textview and button
         private TextView tvErrorMessage;
         private View submitButton;

         private String responseString;

         private ProgressDialog pd;
         final Handler mHandler = new Handler();
         final Runnable mUpdateResults = new Runnable() {
                 public void run() {
                         pd.dismiss();
                         updateResultsInUi();
                 }
         };

         private static int globalStatus = 0;
         private static final int GPS_NOT_FOUND = 1;
         private static final int GPS_OK = 2;

        �...@override
         public void onCreate(Bundle savedInstanceState) {
                 super.onCreate(savedInstanceState);
                 Log.d(LOG_TAG, onCreate);
                 setContentView(R.layout.main);

                 // Set up the button listeners
                 findViews();
                 setListeners();

                 // Register with GPS, throw an error if there's a failure
                 if (!testProviders()) {
                         tvErrorMessage
                                         .setText(Can't get location - check
  that GPS is turned on in
  Settings);
                 }
         }

        �...@override
         public void onRestart() {
                 super.onRestart();
                 Log.d(LOG_TAG, onRestart);
                 // Register with GPS, throw an error if there's a failure
                 if (!testProviders()) {
                         tvErrorMessage
           

[android-developers] Re: GPS accuracy problems

2009-02-11 Thread Ludwig
It is notoriously difficult for GPS chips to get a good fix in built-up
areas. 'Seeing the sky' is a bit loose a formulation: ideally a unit has to
be able to see five or more satellites and for accuracy purposes they must
not be all exactly overhead. Furthermore buildings bounce back the signals
adding to confusion. On a clear mountain top is best, maybe the top of
Canary Wharf tower.
That's why there have been different approaches to improve GPS accuracy,
e.g. triangulation from cell-towers. Skyhook Wireless claim to have a
library that improves accuracy, apparently newer versions of AndNav use it.
Other applications assume that you are always on a road and will place you
on the nearest one.

I just published a little application that gives you a view of the satellite
constellation used to derive your location. You can get it here:
http://andappstore.com/AndroidPhoneApplications/apps/38257
http://andappstore.com/AndroidPhoneApplications/apps/38257That
does not itself improve accuracy, but at least you can get an idea why your
accuracy is shite..

Ludwig


2009/2/11 Anna PS annapowellsm...@googlemail.com


 Hi,

 I'm writing a mapping application. In simple terms, it sends some info
 about the user's current location to a server when the user clicks on
 a button.

 I need the location to be absolutely correct, and when I first started
 to implement LocationListener, I found that it often wasn't. So I've
 used location.getAccuracy() to check the GPS accuracy, and warn the
 user - without submitting the data - if the location isn't accurate
 enough.

 The code is below.

 I've been trying the app outside and find that the accuracy is often
 32m, 64m or even higher, even after 20 or 30 seconds. This is in
 central London, in full view of the sky, on a clear day! I need it to
 be below 10m.

 At the same time, if I open the Maps application while standing in the
 same spot, it shows my GPS location as a blue spot on the map -
 suggesting the listener in Maps has perfect accuracy.

 So what is the problem? Have I implemented the listener/check in the
 wrong way (which feels like the likely explanation), or is it that GPS
 in Android isn't good enough to write mapping applications? Does
 anyone else have experience of this?

 Best,
 Anna

 --

 //cut-down version of code

 public class GPSTest extends Activity {

/** Called when the activity is first created. */
private static final String LOG_TAG = GPSTest;

private Double latitude = 0.0;
private Double longitude = 0.0;
private String latString = ;
private String longString = ;

//Location items
LocationManager locationmanager;
LocationListener listener;
Location location;
private float gpsAccuracy;
private long locationTime;
private long currentTime;
private long timeDifference;

//Textview and button
private TextView tvErrorMessage;
private View submitButton;

private String responseString;

private ProgressDialog pd;
final Handler mHandler = new Handler();
final Runnable mUpdateResults = new Runnable() {
public void run() {
pd.dismiss();
updateResultsInUi();
}
};

private static int globalStatus = 0;
private static final int GPS_NOT_FOUND = 1;
private static final int GPS_OK = 2;

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

// Set up the button listeners
findViews();
setListeners();

// Register with GPS, throw an error if there's a failure
if (!testProviders()) {
tvErrorMessage
.setText(Can't get location - check
 that GPS is turned on in
 Settings);
}
}

@Override
public void onRestart() {
super.onRestart();
Log.d(LOG_TAG, onRestart);
// Register with GPS, throw an error if there's a failure
if (!testProviders()) {
tvErrorMessage
.setText(Can't get location - check
 that GPS is turned on in
 Settings);
}
}

//
 **
// findViews/setListeners: set up the button listeners
//
 **

private void findViews() {
Log.d(LOG_TAG, findViews);
submitButton = (Button) findViewById(R.id.submit_button);
tvErrorMessage = (TextView)