# 手机GPS推流

眼镜gps信息获取偶尔会存在不稳定状态，用户可以通过调用此api来获取与眼镜连接的手机端gps信息

### 注册GPS数据推流

<pre class="language-java"><code class="lang-java"><strong>GPSIPCHelper.registerGPSInfo(this);//注册手机推流gps数据
</strong></code></pre>

### 取消注册GPS数据推流

<pre class="language-java"><code class="lang-java"><strong>GPSIPCHelper.unRegisterGPSInfo(this);//取消手机推流gps数据
</strong></code></pre>

### GPS信息返回

**GPS推流状态信息 (datatype: "gps\_push")**

<table><thead><tr><th>参数名称</th><th>类型</th><th width="368">描述</th><th width="106">示例值</th></tr></thead><tbody><tr><td>resultCode</td><td>Integer</td><td>0手机已连接 1 手机未连接 ，手机未连接发送 （用户连接之后再重新注册推流 ）2.推流超时，请检查手机连接情况重试</td><td>0</td></tr><tr><td>resultMessage</td><td>String</td><td>手机连接推流情况</td><td></td></tr></tbody></table>

**GPS数据信息**

<pre class="language-java"><code class="lang-java"><strong>privateLauncher.OnResponseListenerresponse=newLauncher.OnResponseListener() {
</strong>    @Override
<strong>    public voidonResponse(Response response) {
</strong><strong>        if(response ==null|| response.getData() ==null)
</strong><strong>            return;
</strong><strong>        try{
</strong><strong>        JSONObject jo = new JSONObject(response.getData());
</strong><strong>        if(jo.has("mLatitude") &#x26;&#x26; jo.has("mLongitude") &#x26;&#x26; jo.has("mAltitude")) {//GPS数据，之前与导航传输未封装datatype，兼容之前版本，未再次分装datatype
</strong><strong>            String mProvider = jo.getString("mProvider");
</strong><strong>            Long mTime = jo.getLong("mTime");
</strong><strong>            Long mElapsedRealtimeNanos = jo.getLong("mElapsedRealtimeNanos");
</strong><strong>            Double mLatitude = jo.getDouble("mLatitude");
</strong><strong>            Double mLongitude = jo.getDouble("mLongitude");
</strong><strong>            Double mAltitude = jo.getDouble("mAltitude");
</strong><strong>            Double mSpeed = jo.getDouble("mSpeed");
</strong><strong>            Double mBearing = jo.getDouble("mBearing");
</strong><strong>            Double mHorizontalAccuracyMeters = jo.getDouble("mHorizontalAccuracyMeters");
</strong><strong>            Double mVerticalAccuracyMeters = jo.getDouble("mVerticalAccuracyMeters");
</strong><strong>            Double mSpeedAccuracyMetersPerSecond = jo.getDouble("mSpeedAccuracyMetersPerSecond");
</strong><strong>            Double mBearingAccuracyDegrees = jo.getDouble("mBearingAccuracyDegrees");
</strong><strong>        }catch(JSONException e) {
</strong>            e.printStackTrace();
        }
    }
};
</code></pre>

<br>

**GPS 数据解释**

| **参数名称**                          | 类型     | 描述             | 示例值           |
| --------------------------------- | ------ | -------------- | ------------- |
| **mProvider**                     | String | 位置提供者（GPS、网络等） | "gps"、"lbs"   |
| **mTime**                         | Long   | 位置时间戳          | 1636580423000 |
| **mElapsedRealtimeNanos**         | Long   | <p><br></p>    | <p><br></p>   |
| **mLatitude**                     | Double | 纬度             | 37.7749       |
| **mLongitude**                    | Double | 经度             | -122.4194     |
| **mAltitude**                     | Double | 海拔高度（以米为单位）    | 0             |
| **mSpeed**                        | Double | 速度（以米/秒为单位）    | 5             |
| **mBearing**                      | Double | 获取方向角(单位：度）    | 0             |
| **mHorizontalAccuracyMeters**     | Double | 获取定位精度 单位:米    | 10            |
| **mVerticalAccuracyMeters**       | Double | <p><br></p>    | <p><br></p>   |
| **mSpeedAccuracyMetersPerSecond** | Double | <p><br></p>    | <p><br></p>   |
| **mBearingAccuracyDegrees**       | Double | <p><br></p>    | <p><br></p>   |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://rayneo.gitbook.io/rayneo-devdoc/x-xi-lie/android-kai-fa/ipc-sdk/shou-ji-gps-tui-liu.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
