Write Python to get GPS and posture information for Android devices

Source: Internet
Author: User

On Android, we can use Qpython to write and execute Python scripts. It on many Android

The system functions are conveniently encapsulated, and it is easy to use Qpython to write small programs with simple functions.

This example is the underlying script that I used to read the phone's location information and serve as a further process for processing the data.

#-*-coding:utf-8-*-ImportAndroidhelperImport Time fromMathImportradiansdroid=Androidhelper. Android () droid.startsensingtimed (1, 250) droid.startlocating () while1: Gpsdata=droid.readlocation (). Result S6data=droid.sensorsreadorientation (). ResultifLen (Gpsdata) >0:Printgpsdata['GPS']['Bearing']#Get GPS Guide (bearing) (angle)    ifLen (S6data) >0:PrintS6DATA[0]#Get Compass Azimuth (azimuth) (radians)Time.sleep (0.5) droid.stoplocating () droid.stopsensing ()

Write Python to get GPS and posture information for Android devices

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.