title: onLocationChanged not getting called in Gingerbread
body: <p>I have a mystery for you!  I can get the code below to work on my Samsung Galaxy test phone, which is running 2.2 (Froyo).  It doesn't work on my HTC Thunderbolt test phone, which is running 2.3.4 (Gingerbread).  This is about as simple as it gets when it comes to gathering location info, but I have also implemented the best practices explained <a href="http://android-developers.blogspot.com/2011/06/deep-dive-into-location.html" rel="nofollow">here</a> with the same results:  Froyo is go, Gingerbread is dead.</p>
  
  <p>What are some things I should try in order to solve this problem?  Is it my code?  Is it hardware, software?  Permissions?  Have I angered the computer science gods?  I will accept the first answer given with a suggestion that leads to a solution.  Thanks for the help!</p>
  
  <p>My Activity:</p>
  
  <pre><code>import java.util.List;
  
  import android.app.Activity;
  import android.content.Context;
  import android.location.Location;
  import android.location.LocationListener;
  import android.location.LocationManager;
  import android.location.LocationProvider;
  import android.os.Bundle;
  import android.util.Log;
  import android.widget.Toast;
  
  public class SimpleLocationProjectActivity extends Activity {
  
      private LocationManager mLocationManager;
      private MyLocationListener mLocationListener;
  
      /** Called when the activity is first created. */
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.main);
  
          mLocationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
          mLocationListener = new MyLocationListener();
  
      }
  
      @Override
      protected void onPause() {
          mLocationManager.removeUpdates(mLocationListener);
          super.onPause();
      }
  
      @Override
      protected void onResume() {
          super.onResume();
          Log.i("SIMPLE APP", "Starting location services.");
          List&lt;String&gt; providers = mLocationManager.getAllProviders();
          for (int i = 0 ; i &lt; providers.size(); i++){
              mLocationManager.requestLocationUpdates(providers.get(i), 1, 1, mLocationListener);
          }
  
      }
  
      public class MyLocationListener implements LocationListener{
  
          @Override
          public void onStatusChanged(String provider, int status,
                  Bundle extras) {
              String statusStr;
              switch (status){
              case LocationProvider.OUT_OF_SERVICE:
                  statusStr = "Out of Service";
                  break;
              case LocationProvider.TEMPORARILY_UNAVAILABLE:
                  statusStr = "Temporarily unavailable";
                  break;
              case LocationProvider.AVAILABLE:
                  statusStr = "Available";
                  break;
              default:
                  statusStr = "Huhhh??";  
              }
              Log.i("SIMPLE APP", "Provider:  " + provider + "   Status is:  " + statusStr);
  
  
          }
  
          @Override
          public void onProviderEnabled(String provider) {
              Log.i("SIMPLE APP", "Provider:  " + provider + " is enabled.");
          }
  
          @Override
          public void onProviderDisabled(String provider) {
              Log.i("SIMPLE APP", "Provider:  " + provider + " is disabled.");
          }
  
          @Override
          public void onLocationChanged(Location location) {
              double latitute = location.getLatitude();
              double longitude = location.getLongitude();
              Toast.makeText(SimpleLocationProjectActivity.this, "Lat is " + latitute + "  and lng is " + longitude, Toast.LENGTH_SHORT).show();
  
              //This never gets called on my HTC Thunderbolt...
              Log.i("SIMPLE APP", "Provider:  " + location.getProvider() + "   Lat is " + latitute + "  and lng is " + longitude);
          }
      }
  }
  </code></pre>
  
  <p>My Manifest:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;manifest android:versionCode="1" android:versionName="1.0"
      package="com.silithcrowe.simplelocationproject" xmlns:android="http://schemas.android.com/apk/res/android"&gt;
      &lt;uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/&gt;
      &lt;uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/&gt;
      &lt;uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS"/&gt;
      &lt;uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/&gt;
      &lt;uses-permission android:name="android.permission.INTERNET"/&gt;
  
      &lt;uses-sdk android:minSdkVersion="8"/&gt;
      &lt;application android:icon="@drawable/ic_launcher" android:label="@string/app_name"&gt;
          &lt;activity android:label="@string/app_name" android:name=".SimpleLocationProjectActivity"&gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="android.intent.action.MAIN"/&gt;
                  &lt;category android:name="android.intent.category.LAUNCHER"/&gt;
              &lt;/intent-filter&gt;
          &lt;/activity&gt;
      &lt;/application&gt;
  &lt;/manifest&gt;
  </code></pre>
  
  <p>EDIT:  Sample of logcat while it's running:</p>
  
  <pre><code>03-01 11:37:43.529: D/RPC(1662): read RPC packet
  03-01 11:37:43.529: D/RPC(1662): read RPC packet size: [272]
  03-01 11:37:43.529: V/locapi_rpc_glue(1662): Callback received: 4 (cb_id=0x67E0001 handle=2)
  03-01 11:37:43.529: D/RPC(1662): written RPC packet size: [28]
  03-01 11:37:43.529: D/RPC(1662): read RPC packet
  03-01 11:37:43.529: D/RPC(1662): read RPC packet size: [272]
  03-01 11:37:43.529: V/locapi_rpc_glue(1662): Callback received: 4 (cb_id=0x67E0001 handle=2)
  03-01 11:37:43.529: D/RPC(1662): written RPC packet size: [28]
  03-01 11:37:43.529: D/RPC(1662): read RPC packet
  03-01 11:37:43.529: D/RPC(1662): read RPC packet size: [272]
  03-01 11:37:43.529: V/locapi_rpc_glue(1662): Callback received: 4 (cb_id=0x67E0001 handle=2)
  03-01 11:37:43.529: D/RPC(1662): written RPC packet size: [28]
  03-01 11:37:43.529: D/RPC(1662): read RPC packet
  03-01 11:37:43.529: D/RPC(1662): read RPC packet size: [96]
  03-01 11:37:43.529: V/locapi_rpc_glue(1662): Callback received: 2 (cb_id=0x67E0001 handle=2)
  03-01 11:37:43.529: D/RPC(1662): written RPC packet size: [28]
  03-01 11:37:43.529: D/RPC(1662): read RPC packet
  03-01 11:37:43.529: D/RPC(1662): read RPC packet size: [272]
  03-01 11:37:43.529: V/locapi_rpc_glue(1662): Callback received: 4 (cb_id=0x67E0001 handle=2)
  03-01 11:37:43.529: D/RPC(1662): written RPC packet size: [28]
  03-01 11:37:43.539: D/RPC(1662): read RPC packet
  03-01 11:37:43.539: D/RPC(1662): read RPC packet size: [272]
  03-01 11:37:43.539: V/locapi_rpc_glue(1662): Callback received: 4 (cb_id=0x67E0001 handle=2)
  03-01 11:37:43.539: D/RPC(1662): written RPC packet size: [28]
  03-01 11:37:43.539: D/RPC(1662): read RPC packet
  03-01 11:37:43.539: D/RPC(1662): read RPC packet size: [272]
  03-01 11:37:43.539: V/locapi_rpc_glue(1662): Callback received: 4 (cb_id=0x67E0001 handle=2)
  03-01 11:37:43.539: D/RPC(1662): written RPC packet size: [28]
  03-01 11:37:43.539: D/RPC(1662): read RPC packet
  03-01 11:37:43.539: D/RPC(1662): read RPC packet size: [272]
  03-01 11:37:43.539: V/locapi_rpc_glue(1662): Callback received: 4 (cb_id=0x67E0001 handle=2)
  03-01 11:37:43.539: D/RPC(1662): written RPC packet size: [28]
  03-01 11:37:43.559: D/lib_locapi(1662): loc_eng_report_sv: valid_mask = 0x30, num of sv = 0
  03-01 11:37:43.559: D/GpsLocationProvider(1662): reportSvStatus
  03-01 11:37:44.410: D/RPC(1662): read RPC packet
  03-01 11:37:44.410: D/RPC(1662): read RPC packet size: [208]
  03-01 11:37:44.410: V/locapi_rpc_glue(1662): Callback received: 1 (cb_id=0x67E0001 handle=2)
  03-01 11:37:44.410: D/RPC(1662): written RPC packet size: [28]
  03-01 11:37:44.410: D/lib_locapi(1662): loc_eng_report_position: valid mask = 0x61ed, sess status = 1
  03-01 11:37:44.520: D/RPC(1662): read RPC packet
  03-01 11:37:44.520: D/RPC(1662): read RPC packet size: [272]
  03-01 11:37:44.520: V/locapi_rpc_glue(1662): Callback received: 4 (cb_id=0x67E0001 handle=2)
  03-01 11:37:44.520: D/RPC(1662): written RPC packet size: [28]
  03-01 11:37:44.520: D/RPC(1662): read RPC packet
  03-01 11:37:44.520: D/RPC(1662): read RPC packet size: [272]
  03-01 11:37:44.520: V/locapi_rpc_glue(1662): Callback received: 4 (cb_id=0x67E0001 handle=2)
  03-01 11:37:44.520: D/RPC(1662): written RPC packet size: [28]
  03-01 11:37:44.520: D/RPC(1662): read RPC packet
  03-01 11:37:44.520: D/RPC(1662): read RPC packet size: [272]
  03-01 11:37:44.520: V/locapi_rpc_glue(1662): Callback received: 4 (cb_id=0x67E0001 handle=2)
  03-01 11:37:44.520: D/RPC(1662): written RPC packet size: [28]
  </code></pre>
  
  <p>Sample of logcat when location updates are requested:</p>
  
  <pre><code>I/SIMPLE APP(12524): Starting location services.
  D/AK8975  ( 1544): Ignore M_Sensor: (y, p, r) = ( 293,    1,    2), Status = 2
  D/GpsLocationProvider( 1662): [handleMessage] message :8
  D/GpsLocationProvider( 1662): [handleMessage] ADD_LISTENER
  D/GpsLocationProvider( 1662): addListener(com.seedlabs.simplelocationproject)
  D/GpsLocationProvider( 1662): setMinTime 0
  V/GpsLocationProvider( 1662): enableLocationTracking ++
  D/GpsLocationProvider( 1662): [handleMessage] message :3
  D/GpsLocationProvider( 1662): [handleMessage] ENABLE_TRACKING
  D/GpsLocationProvider( 1662): startNavigating
  D/GpsLocationProvider( 1662): HtcBuildFlag.HtcCIQFlag(FALSE)
  V/LocationManagerService( 1662): requestLocationUpdates
  V/LocationManagerService( 1662): requestLocationUpdatesLocked: updateProvidersLocked
  D/LocationManagerService( 1662): [updateProvidersLocked]
  V/LocationManagerService( 1662): requestLocationUpdates
  V/LocationManagerService( 1662): requestLocationUpdatesLocked: updateProvidersLocked
  D/LocationManagerService( 1662): [updateProvidersLocked]
  V/LocationManagerService( 1662): requestLocationUpdates
  V/LocationManagerService( 1662): requestLocationUpdatesLocked: updateProvidersLocked
  D/LocationManagerService( 1662): [updateProvidersLocked]
  D/lib_locapi( 1662): [GPS:] loc_eng_set_qos_time_out(standalone = 16000, agps = 16000)
  V/GpsLocationProvider( 1662): set_agps_qos_time_out complete
  D/GpsLocationProvider( 1662): GpsLocationProvider_set_position_mode
  D/lib_locapi( 1662): [GPS:] loc_eng_set_position mode, client = 2, interval = 1000, mode = 0
  D/lib_locapi( 1662): [GPS:] loc_eng_set_position mode: GPS_POSITION_MODE_STANDALONE
  D/lib_locapi( 1662): [GPS:] loc_eng_set_position mode before IOCTL, interval=1000, mode =4 preferred_accuracy=50, qos_timeout_standalone=16000, recurrence_type=1
  V/lib_locapi( 1662): loc_eng_ioctl called: client = 2, ioctl_type = 2
  V/locapi_rpc_glue( 1662): loc_ioctl
  D/RPC     ( 1662): written RPC packet size: [96]
  </code></pre>