title: GPS example with Kivy and plyer doesn't work on Android
body: <p>I recently discovered Kivy and have been playing around with some of the simple examples. I modified some of the code in Dusty Phillips book Creating Apps in Kivy but couldn't get GPS output on my Android Phone. I simply want the code to display the location every second. Here is the relevant section of my main.py file:</p>
  
  <pre><code>class AddLocationForm(BoxLayout):
      def myclock(self, *args):
          try:
  
  
              gps.start()
  
          except:
              self.outputs.item_strings=["", "No Location", str(random.random())]
  
      @mainthread
      def on_location(self, **kwargs):
          try:
              self.outputs.item_strings = ["","","", str(kwargs['lat']),"","","",str(kwargs['lon']), "","","",str(random.random())]
          except:
              pass
      def on_status(sefl, **kwargs):
          self.outputs.item_strings = ["", "","", "On status", "", "",str(random.random())]
  
      def send_location(self):
          try:
  
              gps.configure(on_location=self.on_location, on_status=self.on_status)
  
              Clock.schedule_interval(self.myclock, 1)
          except NotImplementedError:
              self.outputs.item_strings=["", "No GPS", str(random.random())]
  
  
  
  class WeatherApp(App):
      def on_pause(self):
          return True
  
  if __name__=='__main__':
      WeatherApp().run()
  </code></pre>
  
  <p>and my KV file is: </p>
  
  <pre><code>AddLocationForm:
  
  &lt;AddLocationForm&gt;:
      orientation: "vertical"
      outputs: outputs_list
      BoxLayout:
          height: "40dp" 
          size_hint_y: None
          Button:
              text: "Start"
              size_hint_x: 25 
              on_press: root.send_location()
          Button:
              text: "End"
              size_hint_x: 25 
      ListView: 
          id: outputs_list
          item_strings: []
  </code></pre>
  
  <p>The app works well on my desktop because it gets to the NotImplementedError. When I compile the app (with buildozer by running <code>buildozer android debug</code> to create the .apk file) and install it on my Android phone it seems to work at first for about a minute and then freezes with no response whatsoever. It doesn't seem to be an issue with the pausing/running in background at first. For example, I can switch between apps and come back to it and it still outputs the location. However, after some time the app just freezes ... without running <code>send_location()</code> more than once</p>
  
  <p>I have enabled access and premissions and plyer library in the buildozer.specs file </p>