Programming Mobile Apps with Python



Similar documents
Some Experiences With Python For Android (Py4A) Nik Klever University of Applied Sciences Augsburg

Andreas Schreiber

Mobile Phones Operating Systems

Developing Applications for ios

Review and Evaluation of Performance Measures in the Mobile Operating Systems

A Review of Different Comparative Studies on Mobile Operating System

KIVY - A Framework for Natural User Interfaces

Introduction to Android

Comparative Study of Different Mobile Operating Systems

Building Mobile Applications Creating ios applications with jquery Mobile, PhoneGap, and Drupal 7

CS378 -Mobile Computing. Android Overview and Android Development Environment

The Decaffeinated Robot

Reminders. Lab opens from today. Many students want to use the extra I/O pins on

Practical Android Projects Lucas Jordan Pieter Greyling

QML and JavaScript for Native App Development

Lecture 3 Mobile App Development (Android, ios, BlackBerry, Windows Mobile) <lecturer, date>

Mobile Application Marketplace 2015: Market Analysis and Assessment of Future Evolution and Opportunities

Using Python for Cross-platform Mobile Application Development

Mobility Introduction Android. Duration 16 Working days Start Date 1 st Oct 2013

01. Introduction of Android

Introduction to Android

Writing standalone Qt & Python applications for Android

Example of Standard API

Social Media & Mobile Handheld Devices: The Platforms, Operating Systems, devices& Applications. The wireless last mile & User Interface choices

Android Architecture. Alexandra Harrison & Jake Saxton

Python for Series 60 Platform

Cell Phone Operating Systems

Introduction to Android Development. Ed Burnette

Issues of Hybrid Mobile Application Development with PhoneGap: a Case Study of Insurance Mobile Application

Choosing a Mobile Application Development Approach

IT Quick Reference Guides How to Find Your MAC Address

The Mobile Device and Operating System Landscape

ios Application Development &

Publishing to TIZEN Using the Automated Conversion/Repackaging of Existing Android Apps. Hyeokgon Ryu, Infraware Technology, Ltd.

ipad, a revolutionary device - Apple

Bridging the Gap: from a Web App to a Mobile Device App

Porting a Python Program to Android

SYST35300 Hybrid Mobile Application Development

Mobile Development with Qt

Lee Barnes, CTO Utopia Solutions. Utopia Solutions

All About Android WHAT IS ANDROID?

BogDan Vatra and Andy Gryc. Qt on Android: Is it right for you?

Lecture 1 Introduction to Android

Mobile Operating Systems. Week I

ANDROID. Programming basics

Università Degli Studi di Parma. Distributed Systems Group. Android Development. Lecture 1 Android SDK & Development Environment. Marco Picone

Develop Once, Deploy Anywhere

Android 5.0: Lollipop OS

Finding Your MAC (Ethernet) Address All Device Types

Leveraging Partners and Open Source Technology in your Mobility Strategy. emids webinar Thursday, August 11, :00 pm 2:00 pm EDT

Automated testing for Mobility New age applications require New age Mobility solutions

INTRODUCTION TO ANDROID CSCI 4448/5448: OBJECT-ORIENTED ANALYSIS & DESIGN LECTURE 11 02/15/2011

Android: How To. Thanks. Aman Nijhawan

Review On Google Android a Mobile Platform

Study of SAP ERP Connection System Driven in Smartphone

The open source cross-platform application development frameworks for smart phones

Developing and deploying mobile apps

MOBILE APPLICATION DEVELOPMENT

Figure 6.1. Windows Phone 7 s hub-based interface, made up of live tiles and information aggregation

Cross-Platform Mobile Apps Solution

Mobile web apps: The best option for business? A whitepaper from mrc

Deployment of Mobile Application for Multiplatform Operating Systems

Android Programming and Security

Study of SAP ERP Connection System Driven in Smartphone

Cross-platform mobile development with Visual C

Evaluating Cross-Platform Development Approaches (WORA Tools ) for Mobile Applications

... Lecture 11. Market Overview of Mobile Operating Systems and Security Aspects. Mobile Business I (WS 2014/15) Prof. Dr.

Smartphone Application Development using HTML5-based Cross- Platform Framework

Smart Phones Application development using HTML5 and related technologies: A tradeoff between cost and quality

How to Choose Right Mobile Development Platform BROWSER, HYBRID, OR NATIVE

Mobile App Development

Discovering Computers

Overview focus on breadth understanding not depth (that s what the labs are for )

Android v ios Mobile Operating Systems

Development Of Mobile Applications GDF Mobilinfo

Full version is >>> HERE <<<

HYBRID APPLICATION DEVELOPMENT IN PHONEGAP USING UI TOOLKITS

Development of mobile applications for multiple platforms

To Study and Design a Cross-Platform Mobile Application for Student Information System using PhoneGap Framework

Creating and Using Databases for Android Applications

ANDROID OPERATING SYSTEM

Mobile App Design and Development

Connecting Your Device to a Wireless Network

How To Use Titanium Studio

Generate Android App

Chapter 1. Introduction to ios Development. Objectives: Touch on the history of ios and the devices that support this operating system.

More details >>> HERE <<<

Android Development. Lecture AD 0 Android SDK & Development Environment. Università degli Studi di Parma. Mobile Application Development

Mobile App Development Using App Inventor

Module Title: Software Development A: Mobile Application Development

How to Run Your Existing Android APK on the Tizen Platform. Chandra Bajpai Matt O Keefe OpenMobile World Wide

OpenCV on Android Platforms

ECE 455/555 Embedded System Design. Android Programming. Wei Gao. Fall

Transcription:

Programming Mobile Apps with Python Andreas Schreiber <andreas.schreiber@medando.de> EuroPython 2012, Florence, Italy (July 3, 2012)

Medando Mobile Health Apps Slide 2

My Blood Pressure Slide 3

Overview Apps and Statistics Apps, Hardware, Markets Early Mobile Development with Python Nokia, Windows Mobile / CE Current Mobile Development with Python Android, ios, Windows Phone Everything else Other systems, summary, conclusions Slide 4

Mobile Apps What is a mobile app? A software designed to run on smartphones, tablet computers, and other mobile devices Limited memory, small screens, touch UI, battery efficient Runs on mobile operating systems Available through application distribution platforms Apps are either free or paid App was Word of the Year in 2010 (USA) Slide 5

Smartphones What is a smartphone? Mobile phone based on a mobile operating platform Combination of PDA functions, camera, media player, Web browser, Equipped with Touch screen, high-speed networking (Wi-Fi, mobile broadband), GPS, NFC, acceleration sensors, Slide 6

Tablet Computers What is a Tablet? A mobile computer that is larger than a smartphone Built as touch screen device Virtual keyboard, sometimes stylus or digital pen Mostly based on x86 or ARM architectures Slide 7

Mobile Operating Systems Popular mobile operating systems Android Apple ios Windows Phone / Mobile / CE RIM BlackBerry Nokia OS / Symbian Samsung Bada Slide 8

Market Share: Smartphone Sales Source: http://en.wikipedia.org/wiki/smartphone Slide 9

App Distribution Application Distribution Platforms Google Play Apple App Store Windows Phone Marketplace (and Windows Marketplace for Mobile) BlackBerry App World Nokia Ovi Store Many more Cross-platform, manufacturer-specific, carrier-specific, Slide 10

Apps in the ios App Store Source: http://en.wikipedia.org/wiki/app_store_(ios) Slide 11

Apps in the Android Market / Google Play 700.000 Google Play Apps 600.000 500.000 400.000 300.000 200.000 100.000 0 Slide 12

Apps in Google Play 25.000.000.000 Google Play Downloads 20.000.000.000 15.000.000.000 10.000.000.000 5.000.000.000 0 Slide 13

Apps in the Windows Phone Marketplace Source: http://www.windowsphoneapplist.com Slide 14

So Many Apps but almost none of them are developed in Python! Slide 15

Early Mobile Development with Python Symbian Window Mobile / CE Slide 16

Symbian Symbian OS Operating system for smartphones and PDAs Micro kernel, 32bit, single user GUI-centric application framework S60 A schematic diagram of the S60 platform architecture. User interface for smartphones Programming for Symbian C++, Java, Web Widgets (Flash Lite), (Python) Slide 17

Python for S60 (PyS60) Python port for S60 platform Developed by Nokia, but development has stopped Open-Source-License (Apache Version 2) Stable Release Last release: 1.4.5 (27.01.2009) Available on SourceForge http://sourceforge.net/projects/pys60 Slide 18

Hello World import appuifw appuifw.app.title = u Hello World" appuifw.note(u"hello World!", 'info') Slide 19

Starting a Python Interpreter Slide 20

Running Scripts Slide 21

Interactive Console Slide 22

Source Code Template 1. Importing modules 2. Setting screen size 3. Applications menu 4. Set. exit key handler (Callback function) 5. Setting app title 6. Application body 7. Active Objects 8. Main Loop import appuifw import e32 appuifw.app.screen = 'normal' def item1(): print "item1 was selected. appuifw.app.menu = [(u"item 1", item1)] def quit(): appuifw.app.set_exit() app.exit_key_handler=quit appuifw.app.title = u'simple Application' app_lock = e32.ao_lock() # starts scheduler -> event processing app_lock.wait() Complete template: http://www.mobilenin.com/pys60/resources/app_skeleton_with_mainloop.py Slide 23

Example Location Based Service Send SMS to someone if certain cell is near (using GSM Cell ID) import location HOME_CELL_ID = u"98521779" # my home in Cologne, Germany WIFE = u"+49173247**** # cell phone number of my wife entries = [u"can t wait to see you!", u"i m hungry.", u"i m in a bad mood."] listbox = appuifw.listbox(entries, shout) home = 0 while home == 0: country, provider, lac, cell = location.gsm_location() if (cell== HOME_CELL_ID): home = 1 message = u"will be at home in a moment and %s" % mood messaging.sms_send(wife, message) Slide 24

Example OpenGL http://tinyurl.com/pys60cube Slide 25

Windows Mobile / CE Windows Mobile Operating system for smartphones Based on Windows CE kernel Implemented in C Programming for Windows Mobile Visual C++ (native code).net framework Tcl-Tk (with etcl) Python with PythonCE Slide 26

Python CE Python port for Windows CE Python CE: http://pythonce.sourceforge.net/ Outdated since 2007 # Send a quick popup message to the user import win32sys win32sys.messagebox(0, "My Message", "My Title", 1) win32sys.messagebeep() # Launch another CE application import win32sh win32sh.shellexecuteex(0, 0, "", "\\Windows\\calc.exe", "", "\\Windows", 1) Slide 27

Current Mobile Development with Python Android ios Windows Phone Slide 28

Android Android Linux-based operating system for mobile devices Developed by the Open Handset Alliance, led by Google Open Source, Apache License Kernel based on Linux-kernel Libraries and APIs written in C Application Framework in Java Java VM Dalvik with JIT Hardware platform: ARM Slide 29

Programming Android Apps are usually developed in Java Software development tools Android Software Development Kit Native Development Kit App Inventor for Android Simple project and Basic4android some others Python!? Slide 30

Python for Android Several options Scripting Layer for Android (SL4A) Python for Android (Py4A) Kivy PySide for Android PyGame Slide 31

Scripting Layer for Android (SL4A) Executes scripts and interactive interpreters on Android Access to many APIs Support for Python Perl Ruby Lua BeanShell JavaScript Tcl Source: Practical Android Projects by Lucas Jordan and Pieter Greyling Available on Google Code: http://code.google.com/p/android-scripting Slide 32

Scripting Layer for Android (SL4A) Support for some UI elements: Dialogs, Toasts, Progressbar, Interactive console Source: Practical Android Projects by Lucas Jordan and Pieter Greyling Slide 33

Scripting Layer for Android (SL4A) Scripts Sharing via barcodes or APKs Hello Word: import android droid = android.android() droid.maketoast('hello, Android!') Slide 34

Python for Android (Py4A) Python interpreter for Android CPython, cross-compiled for Android Used in SL4A Access to many Android APIs Native UI support not complete Website: http://code.google.com/p/python-for-android/ Slide 35

Building an App To build a stand-alone app, the Python for Android interpreter must be included in an APK Project: http://code.google.com/p/android-python27/ Template files Build files Basically requires to change Java code to add your own script public static final String PYTHON_MAIN_SCRIPT_NAME = "hello.py"; public static final String PYTHON_PROJECT_ZIP_NAME = "my_python_project.zip"; File: GlobalConstants.java Slide 36

Kivy Cross platform framework for innovative user interfaces Multi-touch Runs on Android, ios, Linux, Windows, Mac OSX Graphics engines uses OpenGL ES2 Open Source Website: http://kivy.org Slide 37

Kivy Hello World from kivy.app import App from kivy.uix.button import Button class TestApp(App): def build(self): return Button(text='Hello World') TestApp().run() Source: Kivy Website kivy.org Slide 38

See Kivy Poster Outside Poster by Mathieu Virbel Slide 39

PySide for Android For writing GUI applications for Android using Python Based on Python for Android (Py4A) Qt for Android (Necessitas) Python bindings for Qt (PySide) Website: http://thp.io/2011/pyside-android/ Slide 40

PySide for Android Example import sys import traceback def main(): from PySide.QtCore import * from PySide.QtGui import * app = QApplication(sys.argv) w = QLabel('Hello World!') w.show() app.exec_() if name ==" main ": main() Slide 41

Pygame Subset for Android Subset of Pygame for the Android platform Good for developing simple games Website: http://pygame.renpy.org/ Slide 42

ios Slide 43

Apple ios ios Mobile operating system by Apple Multi-touch user interface OS layer: Core OS layer, Core Services, Media layer, Cocoa Touch layer Programming ios Apps are written in Objective-C Software Development Kit and IDE Xcode Python on ios almost not possible Slide 44

Python for ios A Python IDE for the ios http://pythonforios.com/ Slide 45

Python for ios On iphone Slide 46

Python for ios On ipad Slide 47

Python for ios On ipad Slide 48

Python for ios On ipad Slide 49

Kivy You can publish Kivy Apps in the Apple App Store No dynamic linking First App: Deflectouch Slide 50

Windows Phone Windows Phone Mobile operating system by Microsoft Successor to Windows Mobile Programming for Windows Phone Apps must be based on XNA or Silverlight Windows Phone Developer Tools Slide 51

IronPython IronPython Python implementation for the.net platform Since version 2.7.2 (March 2012): Preliminary support for Windows Phone 7.5 No documentation yet http://blog.ironpython.net/2012/03/whats-new-in-ironpython-272.html Slide 52

Everything else Slide 53

Other Mobile Devices Many other devices with Apps Livescribe Amazon Kindle No Python support Maybe support via Jython Slide 54

Summary Python support Symbian Android ios Windows Phone Yes Yes, with Via Kivy Not now restrictions Slide 55

Comparison Matrix by Thomas Perl (@thp4) Source: http://thp.io/2012/mobile-matrix/ Slide 56

Questions? @onyame Conclusions Python on mobile phone not ready for production development of apps Some solutions for scripting and interactive interpretation Slide 57