title: .How does the Android GPS work?
body: <p>I'd like to understand a bit better the way GPS works in Android and I'd like to include some traces to track it and modify its behavior. In GpsLocationProvider.java I found the methods:</p>
  
  <pre><code> private native boolean native_init();
  private native void native_disable();
  private native void native_cleanup();
  private native boolean native_start(int positionMode, boolean singleFix, int fixInterval);
  private native boolean native_stop();
  private native void native_set_fix_frequency(int fixFrequency);
  private native void native_delete_aiding_data(int flags);
  private native void native_wait_for_event();
  // returns number of SVs
  // mask[0] is ephemeris mask and mask[1] is almanac mask
  private native int native_read_sv_status(int[] svs, float[] snrs,
          float[] elevations, float[] azimuths, int[] masks);
  private native int native_read_nmea(int index, byte[] buffer, int bufferSize);
  private native void native_inject_location(double latitude, double longitude, float accuracy);
  
  // XTRA Support
  private native void native_inject_time(long time, long timeReference, int uncertainty);
  private native boolean native_supports_xtra();
  private native boolean native_inject_xtra_data(byte[] data, int length);
  
  // DEBUG Support
  private native String native_get_internal_state();
  
  // AGPS Support
  private native void native_agps_data_conn_open(String apn);
  private native void native_agps_data_conn_closed();
  private native void native_agps_data_conn_failed();
  private native void native_set_agps_server(int type, String hostname, int port);
  
  // Network-initiated (NI) Support
  private native void native_send_ni_response(int notificationId, int userResponse);
  </code></pre>
  
  <p>However, I would like to see what they do in detail. Where are they implemented? I've found the qualcomm drivers for GPS but I guess that there's a missing layer in between where the hardware issues are abstracted (HAL layer?).</p>