title: locationManager.getBestProvider return null
body: <p>I have a problem with provider apparently, my app crashes on launch although i enabled COARSE and FINE location permissions in my manifest. I have also INTERNET permission added.</p>
  
  <p>My code :</p>
  
  <pre><code>locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
      provider = locationManager.getBestProvider(new Criteria(), false);
  
      if (ActivityCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED &amp;&amp; ActivityCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
          ActivityCompat.requestPermissions(
                  this,
                  new String[]{android.Manifest.permission.ACCESS_COARSE_LOCATION, android.Manifest.permission.ACCESS_FINE_LOCATION},
                  PERMISSION_LOCATION_REQUEST_CODE);
      }
      locationManager.requestLocationUpdates(provider, 400, 1, this);
  </code></pre>
  
  <p>And here is the logcat:</p>
  
  <pre><code>E/AndroidRuntime: FATAL EXCEPTION: main
                Process: com.project.korsa.korsa, PID: 32462
                java.lang.RuntimeException: Unable to start activity ComponentInfo{com.project.korsa.korsa/com.project.korsa.korsa.YourLocation}: java.lang.IllegalArgumentException: invalid provider: null
                    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3305)
                    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3401)
                    at android.app.ActivityThread.access$1100(ActivityThread.java:229)
                    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1821)
                    at android.os.Handler.dispatchMessage(Handler.java:102)
                    at android.os.Looper.loop(Looper.java:148)
                    at android.app.ActivityThread.main(ActivityThread.java:7303)
                    at java.lang.reflect.Method.invoke(Native Method)
                    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
                    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
                 Caused by: java.lang.IllegalArgumentException: invalid provider: null
                    at android.location.LocationManager.checkProvider(LocationManager.java:1761)
                    at android.location.LocationManager.requestLocationUpdates(LocationManager.java:464)
                    at com.project.korsa.korsa.YourLocation.onCreate(YourLocation.java:135)
                    at android.app.Activity.performCreate(Activity.java:6904)
                    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1136)
                    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3252)
                    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3401) 
                    at android.app.ActivityThread.access$1100(ActivityThread.java:229) 
                    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1821) 
                    at android.os.Handler.dispatchMessage(Handler.java:102) 
                    at android.os.Looper.loop(Looper.java:148) 
                    at android.app.ActivityThread.main(ActivityThread.java:7303) 
                    at java.lang.reflect.Method.invoke(Native Method) 
                    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230) 
                    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120) 
  </code></pre>