# GnssDriver

Summary:[Ctors](https://developer.android.com/reference/com/google/android/things/userdriver/location/GnssDriver#pubctors)\|[Methods](https://developer.android.com/reference/com/google/android/things/userdriver/location/GnssDriver#pubmethods)\|[Inherited Methods](https://developer.android.com/reference/com/google/android/things/userdriver/location/GnssDriver#inhmethods)\|[\[Expand All\]](https://developer.android.com/reference/com/google/android/things/userdriver/location/GnssDriver#)  

# GnssDriver

`
public


class
GnssDriver
`  
`

extends `[Object](https://developer.android.com/reference/java/lang/Object)`


``


`

|---|----------------------------------------------------------|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | com.google.android.things.userdriver.location.GnssDriver |

<br />

*** ** * ** ***

Driver to interface with user-connected GNSS sensors. To install a GNSS driver, create a GnssDriver object which extends GnssDriver and implements onSetEnabled(boolean), then call[registerGnssDriver(GnssDriver)](https://developer.android.com/reference/com/google/android/things/userdriver/UserDriverManager#registerGnssDriver(com.google.android.things.userdriver.location.GnssDriver))to register it. When a new GNSS reading is available, call[reportLocation(Location)](https://developer.android.com/reference/com/google/android/things/userdriver/location/GnssDriver#reportLocation(android.location.Location))to report it to the framework.

## Summary

|                                                        ### Public constructors                                                         ||
|-------------------------------------------------------------------------------------------------------------------------------------|---|
| ` `[GnssDriver](https://developer.android.com/reference/com/google/android/things/userdriver/location/GnssDriver#GnssDriver())`() ` |

|                                                                                                                                                                                                                                                                                                                  ### Public methods                                                                                                                                                                                                                                                                                                                  ||
|---------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` void` | ` `[reportLocation](https://developer.android.com/reference/com/google/android/things/userdriver/location/GnssDriver#reportLocation(android.location.Location))`(`[Location](https://developer.android.com/reference/android/location/Location.html)` location) ` Report the location to the framework.                                                                                                                                                                                                                                                                                                                                     |
| ` void` | ` `[reportMeasurements](https://developer.android.com/reference/com/google/android/things/userdriver/location/GnssDriver#reportMeasurements(android.location.GnssMeasurementsEvent))`(`[GnssMeasurementsEvent](https://developer.android.com/reference/android/location/GnssMeasurementsEvent.html)` event) ` Report GnssMeasurementsEvent to the framework.                                                                                                                                                                                                                                                                                |
| ` void` | ` `[reportNmea](https://developer.android.com/reference/com/google/android/things/userdriver/location/GnssDriver#reportNmea(java.lang.String))`(`[String](https://developer.android.com/reference/java/lang/String)` rawData) ` Report NMEA to the framework.                                                                                                                                                                                                                                                                                                                                                                               |
| ` void` | ` `[reportStatus](https://developer.android.com/reference/com/google/android/things/userdriver/location/GnssDriver#reportStatus(android.location.GnssStatus))`(`[GnssStatus](https://developer.android.com/reference/android/location/GnssStatus.html)` status) ` Report GnssStatus to the framework.                                                                                                                                                                                                                                                                                                                                       |
| ` void` | ` `[setStateListener](https://developer.android.com/reference/com/google/android/things/userdriver/location/GnssDriver#setStateListener(com.google.android.things.userdriver.location.GnssStateListener))`(`[GnssStateListener](https://developer.android.com/reference/com/google/android/things/userdriver/location/GnssStateListener)` listener) ` Register a gnss state listener Links a GNSS state listener with the system so that it receives callbacks when the framework starts and stops listening for location events.                                                                                                           |
| ` void` | ` `[setStateListener](https://developer.android.com/reference/com/google/android/things/userdriver/location/GnssDriver#setStateListener(com.google.android.things.userdriver.location.GnssStateListener, android.os.Handler))`(`[GnssStateListener](https://developer.android.com/reference/com/google/android/things/userdriver/location/GnssStateListener)` listener, `[Handler](https://developer.android.com/reference/android/os/Handler.html)` handler) ` Register a gnss state listener Links a GNSS state listener with the system so that it receives callbacks when the framework starts and stops listening for location events. |

| ### Inherited methods |
|-----------------------|---|
| [![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/com/google/android/things/userdriver/location/GnssDriver#)From class` `[java.lang.Object](https://developer.android.com/reference/java/lang/Object)` ` |--------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` `[Object](https://developer.android.com/reference/java/lang/Object)          | ` `[clone](https://developer.android.com/reference/java/lang/Object#clone())`() ` Creates and returns a copy of this object.                                                                                                                                                                                                                                                                                                                                                                      | | ` boolean`                                                                     | ` `[equals](https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object))`(`[Object](https://developer.android.com/reference/java/lang/Object)` obj) ` Indicates whether some other object is "equal to" this one.                                                                                                                                                                                                                                                           | | ` void`                                                                        | ` `[finalize](https://developer.android.com/reference/java/lang/Object#finalize())`() ` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.                                                                                                                                                                                                                                                                          | | ` final `[Class](https://developer.android.com/reference/java/lang/Class)`<?>` | ` `[getClass](https://developer.android.com/reference/java/lang/Object#getClass())`() ` Returns the runtime class of this`Object`.                                                                                                                                                                                                                                                                                                                                                                | | ` int`                                                                         | ` `[hashCode](https://developer.android.com/reference/java/lang/Object#hashCode())`() ` Returns a hash code value for the object.                                                                                                                                                                                                                                                                                                                                                                 | | ` final void`                                                                  | ` `[notify](https://developer.android.com/reference/java/lang/Object#notify())`() ` Wakes up a single thread that is waiting on this object's monitor.                                                                                                                                                                                                                                                                                                                                            | | ` final void`                                                                  | ` `[notifyAll](https://developer.android.com/reference/java/lang/Object#notifyAll())`() ` Wakes up all threads that are waiting on this object's monitor.                                                                                                                                                                                                                                                                                                                                         | | ` `[String](https://developer.android.com/reference/java/lang/String)          | ` `[toString](https://developer.android.com/reference/java/lang/Object#toString())`() ` Returns a string representation of the object.                                                                                                                                                                                                                                                                                                                                                            | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait(long, int))`(long millis, int nanos) ` Causes the current thread to wait until another thread invokes the[notify()](https://developer.android.com/reference/java/lang/Object.html#notify())method or the[notifyAll()](https://developer.android.com/reference/java/lang/Object.html#notifyAll())method for this object, or some other thread interrupts the current thread, or a certain amount of real time has elapsed. | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait(long))`(long millis) ` Causes the current thread to wait until either another thread invokes the[notify()](https://developer.android.com/reference/java/lang/Object.html#notify())method or the[notifyAll()](https://developer.android.com/reference/java/lang/Object.html#notifyAll())method for this object, or a specified amount of time has elapsed.                                                                 | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait())`() ` Causes the current thread to wait until another thread invokes the[notify()](https://developer.android.com/reference/java/lang/Object.html#notify())method or the[notifyAll()](https://developer.android.com/reference/java/lang/Object.html#notifyAll())method for this object.                                                                                                                                  | ||

## Public constructors

### GnssDriver

```
GnssDriver ()
```

<br />

<br />

## Public methods

### reportLocation

```
void reportLocation (Location location)
```

Report the location to the framework.

<br />

|                                                                                                 Parameters                                                                                                  ||
|------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `location` | `Location`: A[Location](https://developer.android.com/reference/android/location/Location.html)object. This object must contain accuracy, timestamp, latitude, and longitude attributes. <br /> |

### reportMeasurements

```
void reportMeasurements (GnssMeasurementsEvent event)
```

Report GnssMeasurementsEvent to the framework.

<br />

|                                                                          Parameters                                                                           ||
|---------|------------------------------------------------------------------------------------------------------------------------------------------------------|
| `event` | `GnssMeasurementsEvent`: A[GnssMeasurementsEvent](https://developer.android.com/reference/android/location/GnssMeasurementsEvent.html)object. <br /> |

### reportNmea

```
void reportNmea (String rawData)
```

Report NMEA to the framework.

<br />

|               Parameters                ||
|-----------|------------------------------|
| `rawData` | `String`: NMEA String <br /> |

### reportStatus

```
void reportStatus (GnssStatus status)
```

Report GnssStatus to the framework.

<br />

|                                                          Parameters                                                           ||
|----------|---------------------------------------------------------------------------------------------------------------------|
| `status` | `GnssStatus`: A[GnssStatus](https://developer.android.com/reference/android/location/GnssStatus.html)object. <br /> |

### setStateListener

```
void setStateListener (GnssStateListener listener)
```

Register a gnss state listener Links a GNSS state listener with the system so that it receives callbacks when the framework starts and stops listening for location events.

<br />

|                                                                Parameters                                                                ||
|------------|------------------------------------------------------------------------------------------------------------------------------|
| `listener` | `GnssStateListener`: Gnss state listener to register. A null listener will cause any existing listener to be removed. <br /> |

|                                                                      Throws                                                                       ||
|--------------------------------------------------------------------------------------------------|-------------------------------------------------|
| [IllegalStateException](https://developer.android.com/reference/java/lang/IllegalStateException) | if a gnss state listener is already registered. |

### setStateListener

```
void setStateListener (GnssStateListener listener, 
                Handler handler)
```

Register a gnss state listener Links a GNSS state listener with the system so that it receives callbacks when the framework starts and stops listening for location events.

<br />

|                                                                     Parameters                                                                     ||
|------------|----------------------------------------------------------------------------------------------------------------------------------------|
| `listener` | `GnssStateListener`: Gnss state listener to register. A null listener will cause any existing listener to be removed. <br />           |
| `handler`  | `Handler`: Specifies the handler object for the thread on which to execute the callback. If null, a binder thread will be used. <br /> |

|                                                                      Throws                                                                       ||
|--------------------------------------------------------------------------------------------------|-------------------------------------------------|
| [IllegalStateException](https://developer.android.com/reference/java/lang/IllegalStateException) | if a gnss state listener is already registered. |

-

  ## Interfaces

  - [GnssStateListener](https://developer.android.com/reference/com/google/android/things/userdriver/location/GnssStateListener)
-

  ## Classes

  - [GnssClockBuilder](https://developer.android.com/reference/com/google/android/things/userdriver/location/GnssClockBuilder)
  - [GnssDriver](https://developer.android.com/reference/com/google/android/things/userdriver/location/GnssDriver)
  - [GnssMeasurementBuilder](https://developer.android.com/reference/com/google/android/things/userdriver/location/GnssMeasurementBuilder)
  - [GnssMeasurementsEventBuilder](https://developer.android.com/reference/com/google/android/things/userdriver/location/GnssMeasurementsEventBuilder)
  - [GnssStatusBuilder](https://developer.android.com/reference/com/google/android/things/userdriver/location/GnssStatusBuilder)