# GpsStatus

Added in[API level 3](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Deprecated in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Summary:[Nested Classes](https://developer.android.com/reference/android/location/GpsStatus#nestedclasses)\|[Constants](https://developer.android.com/reference/android/location/GpsStatus#constants)\|[Methods](https://developer.android.com/reference/android/location/GpsStatus#pubmethods)\|[Inherited Methods](https://developer.android.com/reference/android/location/GpsStatus#inhmethods)  

# GpsStatus

*** ** * ** ***

[Kotlin](https://developer.android.com/reference/kotlin/android/location/GpsStatus "View this page in Kotlin")\|Java

`
public

final

class
GpsStatus
`  
`

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


``


`

|---|----------------------------|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.location.GpsStatus |

<br />

*** ** * ** ***

<br />

**This class was deprecated in API level 24.**   
Use[GnssStatus](https://developer.android.com/reference/android/location/GnssStatus)instead.

This class represents the current state of the GPS engine and is used in conjunction with[GpsStatus.Listener](https://developer.android.com/reference/android/location/GpsStatus.Listener).

## Summary

|                                                                                                                                     ### Nested classes                                                                                                                                      ||
|--------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` interface` | [GpsStatus.Listener](https://developer.android.com/reference/android/location/GpsStatus.Listener) *This interface was deprecated in API level 24. Use[GnssStatus.Callback](https://developer.android.com/reference/android/location/GnssStatus.Callback)instead.*             |
| ` interface` | [GpsStatus.NmeaListener](https://developer.android.com/reference/android/location/GpsStatus.NmeaListener) *This interface was deprecated in API level 24. use[OnNmeaMessageListener](https://developer.android.com/reference/android/location/OnNmeaMessageListener)instead.* |

|                                                                                         ### Constants                                                                                          ||
|-------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `int` | [GPS_EVENT_FIRST_FIX](https://developer.android.com/reference/android/location/GpsStatus#GPS_EVENT_FIRST_FIX) Event sent when the GPS system has received its first fix since starting. |
| `int` | [GPS_EVENT_SATELLITE_STATUS](https://developer.android.com/reference/android/location/GpsStatus#GPS_EVENT_SATELLITE_STATUS) Event sent periodically to report GPS satellite status.     |
| `int` | [GPS_EVENT_STARTED](https://developer.android.com/reference/android/location/GpsStatus#GPS_EVENT_STARTED) Event sent when the GPS system has started.                                   |
| `int` | [GPS_EVENT_STOPPED](https://developer.android.com/reference/android/location/GpsStatus#GPS_EVENT_STOPPED) Event sent when the GPS system has stopped.                                   |

|                                                                                                                                                                                                                                        ### Public methods                                                                                                                                                                                                                                        ||
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` static `[GpsStatus](https://developer.android.com/reference/android/location/GpsStatus)                                                                            | ` `[create](https://developer.android.com/reference/android/location/GpsStatus#create(android.location.GnssStatus,%20int))`(`[GnssStatus](https://developer.android.com/reference/android/location/GnssStatus)` gnssStatus, int timeToFirstFix) ` Builds a GpsStatus from the given GnssStatus.                            |
| ` int`                                                                                                                                                               | ` `[getMaxSatellites](https://developer.android.com/reference/android/location/GpsStatus#getMaxSatellites())`() ` Returns the maximum number of satellites that can be in the satellite list that can be returned by[getSatellites()](https://developer.android.com/reference/android/location/GpsStatus#getSatellites()). |
| ` `[Iterable](https://developer.android.com/reference/java/lang/Iterable)`<`[GpsSatellite](https://developer.android.com/reference/android/location/GpsSatellite)`>` | ` `[getSatellites](https://developer.android.com/reference/android/location/GpsStatus#getSatellites())`() ` Returns an array of[GpsSatellite](https://developer.android.com/reference/android/location/GpsSatellite)objects, which represent the current state of the GPS engine.                                          |
| ` int`                                                                                                                                                               | ` `[getTimeToFirstFix](https://developer.android.com/reference/android/location/GpsStatus#getTimeToFirstFix())`() ` Returns the time required to receive the first fix since the most recent restart of the GPS engine.                                                                                                    |

| ### Inherited methods |
|-----------------------|---|
| 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,%20int))`(long timeoutMillis, int nanos) ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*, or until a certain amount of real time has elapsed. | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait(long))`(long timeoutMillis) ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*, or until a certain amount of real time has elapsed.                   | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait())`() ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*.                                                                                             | ||

## Constants

### GPS_EVENT_FIRST_FIX

Added in[API level 3](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final int GPS_EVENT_FIRST_FIX
```

Event sent when the GPS system has received its first fix since starting. Call[getTimeToFirstFix()](https://developer.android.com/reference/android/location/GpsStatus#getTimeToFirstFix())to find the time from start to first fix.

<br />

Constant Value: 3 (0x00000003)  

### GPS_EVENT_SATELLITE_STATUS

Added in[API level 3](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final int GPS_EVENT_SATELLITE_STATUS
```

Event sent periodically to report GPS satellite status. Call[getSatellites()](https://developer.android.com/reference/android/location/GpsStatus#getSatellites())to retrieve the status for each satellite.

<br />

Constant Value: 4 (0x00000004)  

### GPS_EVENT_STARTED

Added in[API level 3](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final int GPS_EVENT_STARTED
```

Event sent when the GPS system has started.

<br />

Constant Value: 1 (0x00000001)  

### GPS_EVENT_STOPPED

Added in[API level 3](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final int GPS_EVENT_STOPPED
```

Event sent when the GPS system has stopped.

<br />

Constant Value: 2 (0x00000002)

## Public methods

### create

Added in[API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Deprecated in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static GpsStatus create (GnssStatus gnssStatus, 
                int timeToFirstFix)
```

Builds a GpsStatus from the given GnssStatus.

<br />

|                             Parameters                             ||
|------------------|--------------------------------------------------|
| `gnssStatus`     | `GnssStatus`: This value cannot be`null`. <br /> |
| `timeToFirstFix` | `int` <br />                                     |

|                                                       Returns                                                       ||
|---------------------------------------------------------------------------------|------------------------------------|
| [GpsStatus](https://developer.android.com/reference/android/location/GpsStatus) | This value cannot be`null`. <br /> |

### getMaxSatellites

Added in[API level 3](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public int getMaxSatellites ()
```

Returns the maximum number of satellites that can be in the satellite list that can be returned by[getSatellites()](https://developer.android.com/reference/android/location/GpsStatus#getSatellites()).

<br />

|                    Returns                     ||
|-------|-----------------------------------------|
| `int` | the maximum number of satellites <br /> |

### getSatellites

Added in[API level 3](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public Iterable<GpsSatellite> getSatellites ()
```

Returns an array of[GpsSatellite](https://developer.android.com/reference/android/location/GpsSatellite)objects, which represent the current state of the GPS engine.

<br />

|                                                                                             Returns                                                                                              ||
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------|
| [Iterable](https://developer.android.com/reference/java/lang/Iterable)`<`[GpsSatellite](https://developer.android.com/reference/android/location/GpsSatellite)`>` | the list of satellites <br /> |

### getTimeToFirstFix

Added in[API level 3](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public int getTimeToFirstFix ()
```

Returns the time required to receive the first fix since the most recent restart of the GPS engine.

<br />

|                     Returns                     ||
|-------|------------------------------------------|
| `int` | time to first fix in milliseconds <br /> |