Reading GPS position #725
Replies: 4 comments 1 reply
-
Of course, I have found examples using android package (import android), but this package seems to be part of Kivy, will it work with BeeWare? |
Beta Was this translation helpful? Give feedback.
-
There isn't a cross-platform Python API for this (yet - it is on our radar). In the meantime, the approach you take is to call the platform native APIs. On Android, this means using Rubicon-java to access the native Java APIs; on iOS, it means using Rubicon-ObjC to access the Objective C APIs. Unfortunately, I don't have a good HOWTO tutorial to point you at. The docs for Rubicon Java and Rubicon ObjC may be some help (although the ObjC docs are a lot more complete). Other than that, the Android and iOS backends of Toga have lots of examples of complex interactions with the underlying libraries; mining that code for examples is probably your best bet. Kivy is an entirely different framework, with it's own packaging tools and API wrapper layers; at this time, Kivy's tools aren't compatible with BeeWare. |
Beta Was this translation helpful? Give feedback.
-
Thank you for a fast response! Of course, what I have forgotten to state clearly but can be concluded, I am interested in Android only. The first question is that a permission to use GPS is required in the manifest file, how can I specify this? Second, I can see that the beeware environment uses/generates some Java classes. Would it be possible to create a Java class with all the required implementation inside and then call the class from Python with rubicon? I can see from examples on the net that the process of reading the position is quite complex (various listeners etc), so my first idea would be to do it all in Java with a simple interface to start/stop locating and return the last available position with time marker. I suspect that some threads may be involved here on the Java side but still should be feasible. |
Beta Was this translation helpful? Give feedback.
-
OK, I have found the manifest file with permissions, with the src directory. So, the first problem is not a problem. |
Beta Was this translation helpful? Give feedback.
-
Hi,
how can I read the current GPS postion from a BeeWare application (in Python, of course)? Any method is ok, either in pure Python or as a reference to Java libraries (if I understand correctly, it is possible with BeeWare?).
Thanks.
Beta Was this translation helpful? Give feedback.
All reactions