title: LocationListener of NETWORK_PROVIDER is enabled but , onLocationChanged is never called
body: <p>I am developing an application that gets position of the cell phone all day long in 6 and 6 minutes in a service, it works fine but sometimes the method <code>OnLocationChanged</code> of the Network provider listener stop to being called, and I don't know why.</p>
  
  <p>It for some reason stop being called, but the Provider is enable and the Lister is working, when I Enable or disable the Provider manually, <code>onProviderEnabled</code> and <code>onProviderDisabled</code> is called.</p>
  
  <p>It just happens with <code>NETWORK_PROVIDER</code>, the <code>GPS_PROVIDER</code> works well.</p>
  
  <p>Listener:</p>
  
  <pre><code>LocationListener locationListenerGPS = new LocationListener() {
          // @Override
          public void onStatusChanged(String provider, int status, Bundle extras) {
              // TODO locationListenerGPS onStatusChanged
              Log.d(TAG, "Provedor trocado");
          }
  
          // @Override
          public void onProviderEnabled(String provider) {
              Log.w(TAG, "PROVEDOR " + provider + " HABILITADO!");
          }
  
          // @Override
          public void onProviderDisabled(String provider) {
              Log.w(TAG, "PROVEDOR " + provider + " DESABILITADO!");
          }
  
          // @Override
          public void onLocationChanged(Location location) {
  
              longitudeGPS = location.getLongitude();
              latitudeGPS = location.getLatitude();
              Log.d(TAG,"LocationChangedGPS LAT: "+latitudeGPS+" longi: "+longitudeGPS);
              gpsComSinal = true;
          }
      };
  
      LocationListener locationListenerNET = new LocationListener() {
  
          // @Override
          public void onStatusChanged(String provider, int status, Bundle extras) {
              // TODO locationListenerNET onStatusChanged
              Log.d("Contele", "Provedor foi mudado");
          }
  
          // @Override
          public void onProviderEnabled(String provider) {
              Log.i(TAG, "PROVEDOR " + provider + " HABILITADO!");
          }
  
          // @Override
          public void onProviderDisabled(String provider) {
              Log.i(TAG, "PROVEDOR " + provider + " DESABILITADO!");
          }
  
          @Override
          public void onLocationChanged(Location location) {
              longitudeNET = location.getLongitude();
              latitudeNET = location.getLatitude();
              Log.d(TAG,"LocationChangedNET LAT: "+latitudeNET+" longi: "+longitudeNET);
              netComSinal = true;
          }
      };
  </code></pre>
  
  <p>Code:</p>
  
  <pre><code>public void initProviders() {
  
          localizacao = (LocationManager) getApplicationContext().getSystemService(LOCATION_SERVICE);
  
  
          localizacao.removeUpdates(locationListenerNET);
          localizacao.removeUpdates(locationListenerGPS);
  
          localizacao.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0,
                  locationListenerGPS);
  
          localizacao.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0,
                  0, locationListenerNET);
  
          Log.d(TAG,"EsperaGPS");
          Handler esperaGPS = new Handler() {
              public void handleMessage(Message msg) {
  
                  requestGPS();
              }
          };
  
          Message msgEsperaGPS = Message.obtain();
          msgEsperaGPS.what = 0;
          esperaGPS.sendMessageDelayed(msgEsperaGPS, 35000);
      }
  
  
  
      public void requestGPS() {
              if (gpsComSinal) {
                  Log.d(TAG,"PEGO SINAL DE GPS");
                  rastreio = "GPS";
                  longitude = longitudeGPS;
                  latitude = latitudeGPS;
                  Log.d(TAG, "Utilizando provedor GPS.");
                  localizacao.removeUpdates(locationListenerGPS);
                  localizacao.removeUpdates(locationListenerNET);
  
              } else {
                  Log.d(TAG,"Sem GPS... pegar NEt");
                  // Setando os valores para usar network
                  localizacao.removeUpdates(locationListenerGPS);
                  localizacao.removeUpdates(locationListenerNET);
                  localizacao
                          .requestLocationUpdates(LocationManager.NETWORK_PROVIDER,
                                  0, 0, locationListenerNET);
                  Log.d(TAG,"EsperaNET");
  
                          requestNET();
              }
          }
  
      public void requestNET() {
              if (netComSinal) {
                  Log.d(TAG,"PEGO SINAL DE NET");
                  rastreio = "NET";
                  longitude = longitudeNET;
                  latitude = latitudeNET;
                  Log.d(TAG, "Utilizando provedor NET.");
                  localizacao.removeUpdates(locationListenerNET);
  
              } else {
                  localizacao.removeUpdates(locationListenerGPS);
                  localizacao.removeUpdates(locationListenerNET);
                  Log.d(TAG,"Sem sinal");
              }
          }
  </code></pre>
  
  <p>Report in a Samsung Galaxy S3:
  <img src="https://i.stack.imgur.com/IehPc.jpg" alt="enter image description here"></p>
  
  <p>Still getting "Sem sinal"  for 4 days in a row.</p>
  
  <p>This issue have already happened with Galaxy Y and LG Optimus l5</p>
  
  <p>I have made another test to see if other aplications got the NET positions, and I discovered that they are passing for the same problem, they can't get the NET position just the GetLastknowLocation; to test that I used a Galaxy S3  with this problem, and I disabled the GPS Provider. (Tested in Cerberus).</p>
  
  <p>I couldn't find any explanation for why NETWORKSLOCATIONS listener stop giving positions, but it might be because it shouldn't work for 2 or 3 days without stop.</p>
  
  <p>I have done some tests with other aplications to see if this issue is just happening with my aplication, and I discovered that they are passing for same problem, like in Cerberus for example :</p>
  
  <p>I disable the GPS Provider in a cellphone (Galaxy S3) with the "Sem sinal" problem, take a look:</p>
  
  <p>My report:
  <img src="https://i.stack.imgur.com/IehPc.jpg" alt="enter image description here"></p>
  
  <p>And Cerberus(print taken in 14/05/2013) report:
  <img src="https://i.stack.imgur.com/8ojzU.jpg" alt="enter image description here"></p>
  
  <p>But When I opened the Google Maps it seems to work OK, I tried to move to a distance place to see if it going to show the <code>GetLastknowLocation</code> , but no, google maps put me in the right place in the moment, so I realized that Google Maps was using motionevent to move me in the map;</p>
  
  <p>And also  print the Log of Google Maps to get NetWorkProvider:</p>
  
  <p>Normal case:</p>
  
  <p><img src="https://i.stack.imgur.com/LSnQ0.png" alt="enter image description here"></p>
  
  <p>Sem sinal case:</p>
  
  <p><img src="https://i.stack.imgur.com/1wABn.jpg" alt="enter image description here"></p>