How to modify the criteria part and get location by GPS automatically in Android?
<p>I would like to set that the device prefer to choose to get location by GPS rather than network provider, but the device still always using network provider to get location. How can I modify the criteria part and get location by GPS automatically?</p>

<p>The criteria I am using: </p>

<pre><code>public void getLocationProvider()   
  {   
    try   
    {   
      Criteria mCriteria01 = new Criteria();   
      mCriteria01.setAccuracy(Criteria.ACCURACY_FINE);   
      mCriteria01.setAltitudeRequired(false);   
      mCriteria01.setBearingRequired(false);   
      mCriteria01.setCostAllowed(true);   
      mCriteria01.setPowerRequirement(Criteria.POWER_LOW);   
      strLocationProvider =    
      mLocationManager01.getBestProvider(mCriteria01, true);   

      mLocation01 = mLocationManager01.getLastKnownLocation   
      (strLocationProvider);   
    }   
    catch(Exception e)   
    {   
      mTextView01.setText(e.toString());   
      e.printStackTrace();   
    }   
</code></pre>

<p>}   </p>
