Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add GPS functionality for Android #47702

Closed
wants to merge 1 commit into from
Closed

Conversation

skysphr
Copy link
Contributor

@skysphr skysphr commented Apr 7, 2021

This adds four GPS-related functions to the Input singleton:

  • start_gps_tracker() where the user specifies the minimum frequency of location fixes and the minimum distance that the device has to move in order to get a location update (for battery saving reasons)
  • stop_gps_tracker()
  • get_locatino() which gives a Lat/Long Vector2 of the location
  • get_altitude() which gives a float representing altitude above the WGS84 ellipsoid

Comment on lines +124 to +127
ClassDB::bind_method(D_METHOD("start_gps_tracker", "time_ms", "distance"), &Input::start_gps_tracker);
ClassDB::bind_method(D_METHOD("stop_gps_tracker"), &Input::stop_gps_tracker);
ClassDB::bind_method(D_METHOD("get_location"), &Input::get_location);
ClassDB::bind_method(D_METHOD("get_altitude"), &Input::get_altitude);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remember to run --doctool with a compiled editor binary to update the class reference XML, then add a description in doc/classes/Input.xml for the newly exposed methods.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added, thanks.

@m4gr3d
Copy link
Contributor

m4gr3d commented Apr 7, 2021

@skysphr This sort of functionality belongs in external Godot plugins and not in core.

@m4gr3d m4gr3d closed this Apr 7, 2021
@m4gr3d
Copy link
Contributor

m4gr3d commented Apr 7, 2021

@skysphr For reference take a look at the documentation for Android plugin: https://docs.godotengine.org/en/stable/tutorials/plugins/android/android_plugin.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants