Can I access the phone's geolocation using a native gomobile
application?
I have seen experimental support for sensor data here, but nothing about the actual latitude, longitude of the device.
I have no prior experience in app development, and I am learning Go at the moment.
AFAIK there is no ready solution yet to access location on both Android and iOS in a platform independent way. But in theory you could make separate packages using the
gomobile
tool to generate bindings for each platform.For example on Android you would use something like:
Where
ctx
is the context (an activity, service, etc.) that you receive in one of their lifecycle callbacks.Also you can use other providers (network, fused).