title: Problem with getting GPS data when using CameraPreview
body: <p>I tried to write some AR app. For now I wrote some code that display camera prewiew and gets data from sensors on the device (acceleromentr, compas, gps reciver).</p>
  
  <p>When I run the code in separate app (like camera preview as one app and application that gets gps data as a second) everything is OK. But when I try to integrate this two modules - GPS stop working; it looks like the listener doesn't get any data. Did You had some similar problems?</p>
  
  <p>The code looks like this:</p>
  
  <pre><code>public void onResume()
  {
      super.onResume();
  
      mLocationManager = (LocationManager)getSystemService(Context.LOCATION_SERVICE);
      mLocationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER,
                                              1000, 0.0f, 
                                              mLocationListener);
  }
  
  
  public void onPause()
  {
      super.onPause();
      mLocationManager.removeUpdates(mLocationListener);
  }
  
  
  private LocationListener mLocationListener = new LocationListener()
  {
  
      public void onLocationChanged(Location pLocation) {
          double lLatitude = pLocation.getLatitude();
          double lLongitude = pLocation.getLongitude();
          mGpsTextView.setText ("Longitude" + Double.toString(lLongitude) + " Latitude: " + Double.toString(lLatitude));
      }
  
      public void onProviderDisabled(String pProvider) {
          mGpsTextView.setText ("Provider disabled");
      }
  
      public void onProviderEnabled(String pProvider) {
          mGpsTextView.setText ("Provider enabled");
      }
  
      public void onStatusChanged(String pProvider, int pStatus, Bundle pExtras) {
          switch (pStatus)
          {
           case LocationProvider.OUT_OF_SERVICE:
               mGpsTextView.setText("GPS out of service");
               break;
           case LocationProvider.TEMPORARILY_UNAVAILABLE:
               mGpsTextView.setText("GPS temorarily unawalible");
               break;
           case LocationProvider.AVAILABLE:
               mGpsTextView.setText("GPS avalible");
               break;
           default:
               mGpsTextView.setText("EEE");
          }
  
     }
  
  };
  </code></pre>
  
  <p>I tried to register/unregister listener in onCreate/onPause but the behaviour is the same.</p>
  
  <p>The cameraPreview code looks like:</p>
  
  <p>private SurfaceHolder.Callback mSurfaceHolderCallback = new SurfaceHolder.Callback()
      {
          private Camera mCamera;</p>
  
  <pre><code>    public void surfaceCreated (SurfaceHolder pSurfaceHolder)
      {
          stopAndReleaseCamera();
          mCamera = Camera.open();
          try {
              mCamera.setPreviewDisplay(pSurfaceHolder);
          }
          catch (Exception imLazy) {
              stopAndReleaseCamera();
              imLazy.printStackTrace();
          }
      }
  
      public void surfaceChanged (SurfaceHolder pSurfaceHolder, int pFormat, int pWidth, int pHeight)
      {
          Parameters lCameraParams = mCamera.getParameters();
          lCameraParams.setPreviewSize (pWidth, pHeight);
          mCamera.setParameters (lCameraParams);
          mCamera.startPreview();
      }
  
      public void surfaceDestroyed (SurfaceHolder pSurfaceHolder)
      {
          stopAndReleaseCamera();
      }
  
      private void stopAndReleaseCamera()
      {
          if (mCamera != null)
          {
              try
              {
                  mCamera.stopPreview();
                  mCamera.release();
              }
              catch (Exception imLazy)
              {
                  //ignore
                  imLazy.printStackTrace();
              }
              mCamera = null;
          }
      }
  };
  </code></pre>
  
  <p>And this is registered in onCreate:</p>
  
  <pre><code>    SurfaceView lSurfaceView = (SurfaceView)findViewById(R.id.CameraSurface);
      lSurfaceView.getHolder().setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
      lSurfaceView.getHolder().setFormat(PixelFormat.TRANSLUCENT);
      lSurfaceView.getHolder().addCallback (mSurfaceHolderCallback);
  </code></pre>
  
  <p>R.id.CameraSurface is defined in layout.xml as</p>
  
  <pre><code>SurfaceView android:id="@+id/CameraSurface"
              android:layout_width="fill_parent"
              android:layout_height="fill_parent"
  </code></pre>
  
  <p>Any ideas what is wrong?</p>
  
  <p>The code was tested on three different phones</p>