20130409 1 developing apps for android with kivy

3,605 views

Published on

Published in: Technology
0 Comments
6 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
3,605
On SlideShare
0
From Embeds
0
Number of Embeds
392
Actions
Shares
0
Downloads
66
Comments
0
Likes
6
Embeds 0
No embeds

No notes for slide

20130409 1 developing apps for android with kivy

  1. 1. www.DLR.de • Chart 1 > droidcon 2013 > A. Schreiber • Developing Apps for Android and Other Platforms with Kivy and Python > 09.04.2013Developing Apps for Androidand Other Platforms with Kivyand PythonAndreas Schreiber <andreas.schreiber@dlr.de>droidcon 2013, Berlin, 09. April 2013
  2. 2. www.DLR.de • Chart 2 > droidcon 2013 > A. Schreiber • Developing Apps for Android and Other Platforms with Kivy and Python > 09.04.2013Outline• Introduction• Python• Kivy• Demos• Limitations• Credits
  3. 3. www.DLR.de • Chart 3 > droidcon 2013 > A. Schreiber • Developing Apps for Android and Other Platforms with Kivy and Python > 09.04.2013Me Scientist, Head of department Founder, CEO Enthusiastic about Python
  4. 4. www.DLR.de • Chart 4 > droidcon 2013 > A. Schreiber • Developing Apps for Android and Other Platforms with Kivy and Python > 09.04.2013DLRGerman Aerospace Center− Research Institution− Space Agency− Project Management Agency
  5. 5. www.DLR.de • Chart 5 > droidcon 2013 > A. Schreiber • Developing Apps for Android and Other Platforms with Kivy and Python > 09.04.2013Locations and employees7400 employees across Stade  Hamburg32 institutes and facilities at  Neustrelitz Bremen   Trauen 16 sites. Berlin  Braunschweig Offices in Brussels, Paris,  GoettingenTokyo and Washington. Juelich   Cologne  Bonn~1400 employees develop software Lampoldshausen  Stuttgart  Augsburg   Oberpfaffenhofen Weilheim 
  6. 6. www.DLR.de • Chart 6 > droidcon 2013 > A. Schreiber • Developing Apps for Android and Other Platforms with Kivy and Python > 09.04.2013Python
  7. 7. Python• General-purpose, high-level programming language• Object-oriented, aspect-oriented, functional• Dynamic type system• Easy-to-learn with clear and expressive syntax def faculty(x): if x > 1: return x * faculty(x - 1) else: return 1
  8. 8. www.DLR.de • Chart 8 > droidcon 2013 > A. Schreiber • Developing Apps for Android and Other Platforms with Kivy and Python > 09.04.2013Python on Mobile DevicesEarly Mobile Development with Python• PyS60 for Symbian• Python CE for Windows MobileCurrent Mobile Development with Python• Scripting Layer for Android (SL4A)• Python for Android (Py4A)• PySide / Qt for Android• WinRT / IronPython for Windows 8• Kivy…
  9. 9. www.DLR.de • Chart 9 > droidcon 2013 > A. Schreiber • Developing Apps for Android and Other Platforms with Kivy and Python > 09.04.2013Kivy
  10. 10. www.DLR.de • Chart 10 > droidcon 2013 > A. Schreiber • Developing Apps for Android and Other Platforms with Kivy and Python > 09.04.2013Kivy• Platform-independent Python-Framework• Available for • Android • iOS • Meego • Windows kivy.org • Linux • OSX • (Raspberry Pi)• Development in Python on all platforms • Not emulated!
  11. 11. www.DLR.de • Chart 11 > droidcon 2013 > A. Schreiber • Developing Apps for Android and Other Platforms with Kivy and Python > 09.04.2013Kivy Basics• Framework for Natural User Interfaces (NUI) • Touchscreens / Multi-Touch• GPU accelerated graphics • Based on OpenGL ES 2.0• Suitable for prototypes as well as products • Porting to new platforms is easy
  12. 12. www.DLR.de • Chart 12 > droidcon 2013 > A. Schreiber • Developing Apps for Android and Other Platforms with Kivy and Python > 09.04.2013Kivy Software• Open Source (LGPL), 7 Core developer• Source code: https://github.com/kivy• Documentation: http://kivy.org/docs• Kivy on Google Play: https://play.google.com/store/apps/details?id=org.kivy.pygame
  13. 13. www.DLR.de • Chart 13 > droidcon 2013 > A. Schreiber • Developing Apps for Android and Other Platforms with Kivy and Python > 09.04.2013Kivy says Hello! from kivy.app import App from kivy.uix.button import Button class HelloApp(App): def build(self): return Button(text=Hello Berlin) HelloApp().run()
  14. 14. www.DLR.de • Chart 14 > droidcon 2013 > A. Schreiber • Developing Apps for Android and Other Platforms with Kivy and Python > 09.04.2013
  15. 15. www.DLR.de • Chart 15 > droidcon 2013 > A. Schreiber • Developing Apps for Android and Other Platforms with Kivy and Python > 09.04.2013Development with Kivy• Python for widgets, input, program logic• Language KV for layout und graphics• Cython for low-level access to graphic routines
  16. 16. www.DLR.de • Chart 16 > droidcon 2013 > A. Schreiber • Developing Apps for Android and Other Platforms with Kivy and Python > 09.04.2013“Hello Berlin” with KV from kivy.app import App class HelloApp(App): pass HelloApp().run() File hello.kv defines root widget #:kivy 1.0 Button: text: ‘Hello Berlin’
  17. 17. www.DLR.de • Chart 17 > droidcon 2013 > A. Schreiber • Developing Apps for Android and Other Platforms with Kivy and Python > 09.04.2013Example: Pong import kivy from kivy.app import App from kivy.uix.widget import Widget class PongGame(Widget): pass class PongApp(App): def build(self): return PongGame() if __name__ == __main__: PongApp().run()
  18. 18. www.DLR.de • Chart 18 > droidcon 2013 > A. Schreiber • Developing Apps for Android and Other Platforms with Kivy and Python > 09.04.2013Pong Graphics #:kivy 1.6.0 <PongGame>: canvas: Rectangle: pos: self.center_x - 5, 0 size: 10, self.height Label: font_size: 70 center_x: root.width / 4 top: root.top - 50 text: "0" Label: font_size: 70 center_x: root.width * 3 / 4 top: root.top - 50 text: "0"
  19. 19. www.DLR.de • Chart 19 > droidcon 2013 > A. Schreiber • Developing Apps for Android and Other Platforms with Kivy and Python > 09.04.2013PongFull example: http://kivy.org/docs/tutorials/pong.html
  20. 20. www.DLR.de • Chart 20 > droidcon 2013 > A. Schreiber • Developing Apps for Android and Other Platforms with Kivy and Python > 09.04.2013Accessing Java Classes from Python• Smartphones have many APIs • Camera, Compass, Contacts, Location, …• Access from Python via PyJNIus • https://github.com/kivy/pyjnius • Implemented with JNI and Java reflectionExample from jnius import autoclass Hardware = autoclass(org.renpy.android.Hardware) print DPI is, Hardware.getDPI()
  21. 21. www.DLR.de • Chart 21 > droidcon 2013 > A. Schreiber • Developing Apps for Android and Other Platforms with Kivy and Python > 09.04.2013Packaging• Creating packages for Windows, OSX, Android und iOS: http://kivy.org/docs/guide/packaging.html
  22. 22. www.DLR.de • Chart 22 > droidcon 2013 > A. Schreiber • Developing Apps for Android and Other Platforms with Kivy and Python > 09.04.2013Build ToolsTool chain• Python-for-android• Cross compiler for ARM• Android SDK & NDK• Python and some Python packagesBuildozer• Hides the complexity: Downloads, compiles, packages Kivy source code• https://github.com/kivy/buildozer % buildozer android debug deploy run
  23. 23. www.DLR.de • Chart 23 > droidcon 2013 > A. Schreiber • Developing Apps for Android and Other Platforms with Kivy and Python > 09.04.2013Demos
  24. 24. www.DLR.de • Chart 24 > droidcon 2013 > A. Schreiber • Developing Apps for Android and Other Platforms with Kivy and Python > 09.04.2013Kivy Showcase
  25. 25. www.DLR.de • Chart 25 > droidcon 2013 > A. Schreiber • Developing Apps for Android and Other Platforms with Kivy and Python > 09.04.2013Kivy Pictures
  26. 26. www.DLR.de • Chart 26 > droidcon 2013 > A. Schreiber • Developing Apps for Android and Other Platforms with Kivy and Python > 09.04.2013Small Dragon LukiSpeech therapy game for kids
  27. 27. www.DLR.de • Chart 27 > droidcon 2013 > A. Schreiber • Developing Apps for Android and Other Platforms with Kivy and Python > 09.04.2013Small Dragon Luki
  28. 28. www.DLR.de • Chart 28 > droidcon 2013 > A. Schreiber • Developing Apps for Android and Other Platforms with Kivy and Python > 09.04.2013MQTT Client
  29. 29. www.DLR.de • Folie 29 mobile.cologne > Andreas Schreiber • Plattformübergreifende Apps entwickeln mit Kivy und Python > 08.11.2012Steering Plant Growth• Webcam takes picture of plants• Computer detects plant• Computer generates an image for lighting• Light source (e.g., a projector) illuminates the plant using the generated image
  30. 30. www.DLR.de • Chart 30 > droidcon 2013 > A. Schreiber • Developing Apps for Android and Other Platforms with Kivy and Python > 09.04.2013
  31. 31. www.DLR.de • Chart 31 > droidcon 2013 > A. Schreiber • Developing Apps for Android and Other Platforms with Kivy and Python > 09.04.2013
  32. 32. www.DLR.de • Chart 32 > droidcon 2013 > A. Schreiber • Developing Apps for Android and Other Platforms with Kivy and Python > 09.04.2013
  33. 33. www.DLR.de • Chart 33 > droidcon 2013 > A. Schreiber • Developing Apps for Android and Other Platforms with Kivy and Python > 09.04.2013
  34. 34. www.DLR.de • Chart 34 > droidcon 2013 > A. Schreiber • Developing Apps for Android and Other Platforms with Kivy and Python > 09.04.2013Other Examples…
  35. 35. iOS-App Deflectouchhttps://itunes.apple.com/de/app/deflectouch/id505729681
  36. 36. iOS/Android-App ProcessCrafthttps://itunes.apple.com/gb/app/processcraft/id526377075http://showgen.com
  37. 37. www.DLR.de • Chart 37 > droidcon 2013 > A. Schreiber • Developing Apps for Android and Other Platforms with Kivy and Python > 09.04.2013Limitations
  38. 38. www.DLR.de • Chart 38 > droidcon 2013 > A. Schreiber • Developing Apps for Android and Other Platforms with Kivy and Python > 09.04.2013Missing, but Planned (or In Progress)User Interface Designer• Design tool for Kivy Language KV• Planned for GSoCAbstraction of mobile APIs• Platform-independent Python wrapper for platform APIs (Android, iOS, Linux/Mac/Windows)• Project Plyer will start as GSoC project maybePorting to Raspberry Pi• Useful for small/cheap standalone systems• Founded via Crowdsourcing (bountysource.com)
  39. 39. www.DLR.de • Chart 39 > droidcon 2013 > A. Schreiber • Developing Apps for Android and Other Platforms with Kivy and Python > 09.04.2013CreditsThanks to the Kivy developers • Mathieu Virbel (@mathieuvirbel) • Thomas Hansen (@hansent) • Gabriel Pettier (@tshirtman) • and many others
  40. 40. www.DLR.de • > A. > droidcon 2013 Chart 40 Schreiber • Developing Apps for Android and Other Platforms with Kivy and Python > 09.04.2013Questions? Summary • Kivy allows platform-independent development of apps for Android, iOS, Meego, Windows, OSX and Linux • Suitable for multi-touch and graphics applications, such as kiosk systems, exhibits, games, … Andreas Schreiber Twitter: @onyame http://www.dlr.de/sc

×