12944qwerty
12944qwerty

Reputation: 1925

How do I access the location of an iPhone with kivy?

I'm trying to access the location of my iPhone using kivy but haven't been able to figure it out. I've Googled it a bunch of times but it never worked. I got to here, but pyjnius seems to be only for Android, not iPhone.

Upvotes: 1

Views: 1265

Answers (1)

Tshirtman
Tshirtman

Reputation: 5947

https://github.com/kivy/plyer/ plyer supports gps location on both android (through pyjnius) and ios (through pyobjus), https://github.com/kivy/plyer/blob/master/examples/gps/main.py this basic example should give you a good start.

the important part is configuring the gps

            gps.configure(on_location=self.on_location,
                          on_status=self.on_status)

and later starting it with gps.start() and handling the coordinates in your on_location method.

    @mainthread
    def on_location(self, **kwargs):
        self.gps_location = '\n'.join([
            '{}={}'.format(k, v) for k, v in kwargs.items()])

Upvotes: 2

Related Questions