title: Mocking locations on Android Marshmallow
body: <p>I'm attempting to create a simple app to mock GPS coordinates.
  I have setup the correct permissions in manifest.
  The problem is actually mocking the address.
  I have tested the following code with no success:</p>
  
  <pre><code>lm = (LocationManager)getSystemService(Context.LOCATION_SERVICE);
  ll = new MyLocationListener();
  if (lm.getProvider("Test") == null) {
      lm.addTestProvider("Test", false, false, false, false, false, false, false, 0, 1);
  }
  lm.setTestProviderEnabled("Test", true);
  lm.requestLocationUpdates("Test", 0, 0, ll);
  
  map.setOnMapClickListener(new GoogleMap.OnMapClickListener() {
      @Override
      public void onMapClick(LatLng l) {
          Location loc = new Location("Test");
          loc.setLatitude(l.latitude);
          loc.setLongitude(l.longitude);
          loc.setAltitude(0); 
          loc.setAccuracy(10f);
          loc.setElapsedRealtimeNanos(System.nanoTime());
          loc.setTime(System.currentTimeMillis()); 
          lm.setTestProviderLocation("Test", loc);
      }
  };
  </code></pre>
  
  <p>I have also attempted to use <code>FusedLocationApi</code> which does work for any apps using the google framework. Google maps, for example, works perfectly fine.</p>
  
  <p>Although the problem I have found with <code>FusedLocationApi</code> is that it does not mock the location for any apps outside of the Google framework which is a problem. Apps outside the google framework generally report that "No GPS is being detected". </p>
  
  <p>I really hope someone can guide me in the right direction!</p>