python实现卫星定位,在Python中获取精确的Android GPS位置

本文讨论了如何在Python中,特别是使用QPython3 app时,获取Android设备的精确GPS位置。目前的问题是,代码只能获取由网络提供而非GPS提供的位置信息,导致精度不足。作者分享了代码片段,并寻求解决办法以强制使用GPS定位。解决方案是在循环中加入`droid.eventClearBuffer()`来清除事件缓冲区,以便获取新的GPS位置更新。
摘要由CSDN通过智能技术生成

I try to obtain the GPS-Location of my Android Phone in Python (using QPython3 app). This kind of works, but it seems there are several LocationProviders in Android:

gps: pure gps location, slow, energy consuming, but very accurate,

and exactly what I need.

network: mix of gps and wifi/cell locating, faster, but less accurate

passive: like above but completely without using gps

Problem:

When I run my script (below) I only get my location provided by "network"

wich is not accurate enough.

But I can't find a way to force a specific LocationProvider.

Code:

# import needed modules

import android

import time

import sys, select, os #for loop exit

#Initiate android-module

droid = android.Android()

#notify me

droid.makeToast("fetching GPS data&

  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值