title: NETWORK_PROVIDER not Working in android
body: <p>I build app for User to get last location or current location. I use both <code>NETWORK_PROVIDER</code> and <code>GPS_PROVIDER</code>.I have little problem with <code>NETWORK_PROVIDER</code>.</p>
  
  <p>1.When i use <code>NEWTWORK_PROVIDER</code> in Micromax unit 2 than the app crash and when I use <code>GPS_PROVIDER</code> than app is working good. And same Application is working fine in Samsung and XIOMI devices while using both providers. Any Reason behind this?</p>
  
  <ol start="2">
  <li><p>Is <code>NETWORK_PROVIDER</code> supported for only limited version?</p></li>
  <li><p>If some device doesn't support <code>NETWORK_PROVIDER</code> than what can i do to get current location without GPS?</p></li>
  </ol>
  
  <p>Here's my code:</p>
  
  <pre><code>    private void beginAcquiringLocation() {
  
      //Log.d(TAG, "Beginning location acquisition");
      logStatus("Requesting location update.");
  
      // we don't want to be killed while handling data transmission in another thread
      // to guarantee we don't take an eternal lock even in case of bugs, set a timeout
      acquireWakeLock(WAKELOCK_TIME_DEFAULT);
  
      LocationManager locationManager =(LocationManager) this.getSystemService(Context.LOCATION_SERVICE);
      Criteria crit = new Criteria();
      String provider = locationManager.getBestProvider(crit, false);
      Location location = locationManager.getLastKnownLocation(provider);
  
      Log.d("LOCATION&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;", String.valueOf(location));
  
      Log.d("Provider----------&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;", provider);
       // no significant time or distance minima, we'll decide if it's usable when we get a coord
      locationManager.requestLocationUpdates(provider, 500, 0, this);
  
      if(String.valueOf(location).equals("null")){
  
          locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 500, 0, this);
          Location l=locationManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
          Log.d("-------Location default-----&gt;&gt;&gt;&gt;&gt;&gt;&gt;", String.valueOf(l));
  
  
      }
      // next action in process is in the callback upon receiving a location update
  
      // to prevent endless listening if no updates are ever received, we need to schedule a timeout
      timeoutHandler.removeCallbacks(timeoutTask);
      timeoutHandler.postDelayed(timeoutTask, timeoutDelay);
  }
  </code></pre>