android - Qpython Plyer GPS - Crash on call of gps.start() method -


my goal know geographic coordinates of nexus 5 (andrid 5.1.1) using python module plyer(version 1.2.4).

so installed interpreter qpython2.7(version 1.0.6) on smartphone , wrote following code inspired example on plyer documentation https://plyer.readthedocs.org/en/latest/#plyer.facades.gps . qpyton2.7 installation include kivy module(version 1.8.0) used in code.

what expect program do:

when press button program'll start location updates when press again program'll stop updates. when program updates location it'll call loc() method update button text value current location.

what program do:

it crashes on gps.start() call.

notes:

the program doesn't crash on gps.configure() previous call. method vibrator.vibrate() of plyer module works fine!

error reported:

...

file "jnius_export_class.pxi", line 562, in jnius.jnius.javamethod.call (jnius/jnius.c:17724) file "jnius_export_class.pxi", line 656, in jnius.jnius.javamethod.call_method (jnius/jnius.c:18722) file "jnius_utils.pxi", line 43, in jnius.jnius.check_exception (jnius/jnius.c:3175) jnius.jnius.javaexception: jvm exception occured

the code:

#qpy:kivy  plyer import vibrator plyer import gps kivy.app import app kivy.uix.button import button   class testapp(app):      def build(self):         self.locbutton = button(text='start', on_press=self.start_stop)         return self.locbutton      def on_start(self):         gps.configure(on_location=self.loc)      def loc(self, **kwargs):         self.locbutton.text = 'lat:{lat},lon:{lon}'.format(**kwargs)      def start_stop(self, instance):         if self.locbutton.text == 'start':             #self.locbutton.text = 'stop'             gps.start()         else:             gps.stop()             self.locbutton.text = 'start'         vibrator.vibrate(0.01)  testapp().run() 

the code not run because of method call bes gps plyer passing parameters on_location = function example:

from plyer import gps kivy.app import app import kivy.uix.button button  class mi_app(app):     def buscar_coord (self, **kwargs):         info = kwargs.items()         ## decodificas json         print str(info)     def gps_activar(self, ins):         self.buscar_coord()     def build(self):         gps.configure (on_location = self.buscar_coord)         ## call start method         gps.start ()         return button(text = "test_gps" on_release = self.gps_activar)  mi_app().run() 

Comments

Popular posts from this blog

searchKeyword not working in AngularJS filter -

sequelize.js - Sequelize: sort by enum cases -

user interface - how to replace an ongoing process of image capture from another process call over the same ImageLabel in python's GUI TKinter -