简体   繁体   中英

Access GPS data on Unity3d with Android devices

Is there anyway to acces the gps data on android devices with Unity3D?

I know that iPhones have "iPhoneSettings.StartLocationServiceUpdates()". I'm looking for something similar for android.

Thanks!

You can access the gps data in unity3d for android devices in the following way:

Input.location.Start ();  //start gps
// any method/member you need from Input.location like timestamp or any positional variables.
Input.location.Stop ();   //stop gps (good for battery economy)

You can refer here for more info: http://docs.unity3d.com/ScriptReference/LocationService.html

根据这篇博文,您必须使用相同的API: iPhoneSettings.StartLocationServiceUpdates()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM