IELM 511: Information System design Introduction Part 1. ISD for well structured data – relational and other DBMS Info storage (modeling, normalization) Info retrieval (Relational algebra, Calculus, SQL) DB integrated API’s Part 2. ISD for systems with non-uniformly structured data Basics of web-based IS (www, web2.0, …) Markup’s, HTML, XML Design tools for Info Sys: UML Part III: (subset of) API’s for mobile apps Security, Cryptography IS product lifecycles Algorithm analysis, P, NP, NPC
Agenda Need and applications of mobile apps Problems in development of mobile apps Case study: Google Android Concluding remarks
Mobile computing: Needs and Applications Location and guidance systems, e.g. GPS and Map-based services Logistics services, e.g. FedEx/DHL delivery tracking/receiving systems Ubiquitous computing, e.g. Internet fridge, Home device controls, Building security systems
Mobile computing: Issues Hardware: Lower Bandwidth (wireless bandwidth is lower than wired) Data transfer is slower (e.g. poor performance of iPhone GPS) Limited battery power Restricted to low power consumption apps Reliability Wireless service (cells) do not cover all areas, e.g. Mfg Sys Lab ! Human Computer Interface (HCI) For small mobile devices, e.g. phones/PDAs, user-interface is an issue Software: Multi-purpose devices Multi-tasking/threading, prioritizing and switching between processes
Common Mobile Phone OS’s Symbian OS (used by Nokia, Sony-Ericsson, …) - Pre-emptive multi-tasking - Closed source, Uses C++, Supports Java, - App development requires certification RIM Blackberry (used by Blackberry phones) - Simple GUI, Optimized applications and HCI for email Windows mobile (used by Samsung, AT&T, LG, Palm Treo) - GUI emulates windows on PC - Software development kit (SDK) is free for students, uses Visual C++, .NET iPhone OS (used by Apple iPhones) - Based on Apple OS X - GUI: user friendly, touch-screen only (no keypad support) Google Android (used by Google phone, HTC, …) - Linux-based OS, Open source ! - SDK is free, uses Java
Comparing mobile apps with desktops.. What differentiates mobile apps from desktop apps ? - Networked applications must deal with cellular communications - Mobile OS (and apps have very limited resources: Smaller size, Less RAM, Slower low energy CPU, Limited graphics, RAM is smaller, … mobile multimedia formats and file formats are different - Mobile I/O systems are quite different from desktop ones Touch-screen based, phone-keys based, reduced keyboard-based, …
Mobile Application Development: Case study - Android Steps in Android Application development: Download and install SDK Develop the application: Eclipse IDE (Java, SQLite, XML) Test the application: Android emulator Register with Google (US$ 25) Upload your application to Google App Store
Android OS Architecture Phone users App developers Programmers Hardware developers
Resources: Data, sound files, images data java code java code mp3 # library calls Structure of an Android Application Android apps are stored in ‘packages’ aapt MyApp.apk Android OS is multi-processing, multi-threading multiple processes can be running on the device at the same time. Processes can communicate w/ the OS, and also can communicate w/ each other
Logical structure and life of an Android Application An Android app is composed of a set of components - Each component does a well defined activity - Due to multi-tasking, multiple components could be doing something at the same time - An app may use a component from some other app, and/or it may allow other apps to use some of its components When an app is executed, Android creates a “virtual computer” in which the process runs each process is isolated from others. This is implemented via the DalVik Virtual Machine [Java Virtual Machine] security However, processes can share data with each other via special components called ‘content providers’
Android components: Activities Activity is a sequence of related actions Each activity presents a visual interface to the user Each activity is derived from base class Activity Each activity owns a View which controls a rectangular window; Child views (controlling sub-rectangles) can be derived from parents; Views are used to create images, icons, buttons, etc. Examples: The “Contacts” application may have an activity that displays a scrolling list of all contacts listed by last name. The “Calculator” app may have an activity that displays a numeric keyboard and buttons for numeric operations, etc. and awaits inputs from the user.
Android API – activity control loop Colored ovals: states of the activity Grey rectangles: callback methods written by developer source: developer.android.com
Android components: Services Service is an activity that runs in the background no visual interface Each activity is derived from base class Service Example: A common example of a service is an mp3 player that may run in the background as the user may be involved with some activity of another app, e.g. web browser.
Android API – service control loop Colored ovals: states of the service Grey rectangles: callback methods written by developer NOTE: Typically, a service may be created, say, by an activity; Alternatively, a service may be started and running in some other context, and can announce its interface to other activities – in this case, the activity may just connect itself to the service, in Android, this is called “bind”-ing to the service. source: developer.android.com
Android components: Broadcast receivers Broadcast receivers are similar to interrupt handlers in normal OS BRs run in the background, listening for interrupts generated by other apps An application may have one or more BR’s to handle interrupts. Examples of interrupts: - Incoming phone call - User changed language setting - Battery is low - User has transited from one time zone to different one
Android components: Content providers Content providers make some subset of an application’s data available to other apps when requested Content providers are the only mechanism for apps to share data.
Android application process Process can be multi-threaded Android apps do not have a C-style “main”. Activities, services, broadcast receivers: activated by messages called intents. Content providers: activated by special objects called ContentResolvers. Depending on the state of the application, and the user’s actions, the app may start (or terminate) some activity, or service, etc. Before Android can start an application component, it must know the name, location, and input types of the component The manifest <?xml version="1.0" encoding="utf-8"?> <manifest package="com.example.android.notepad" …> <application android:icon="@drawable/app_notes" android:label="@string/app_name" > <activity android:name="NotesList" android:label="@string/title_notes_list"> <intent-filter> <action android:name="android.intent.action.MAIN" /> … </intent-filter> <intent-filter> <action android:name="android.intent.action.VIEW" /> <action android:name="android.intent.action.EDIT" /> <action android:name="android.intent.action.PICK" /> … </intent-filter> … </activity> </application> </manifest> Notepad app (partial manifest)
Views in Android Most activities will present a ‘view’ to the user, either to display some graphics, or to get some user-input. Thus each activity can create (instances) of one or more views. Each view has some graphical objects that either fill the complete screen, or a part of the screen. Each object in a view, i.e. the layout, is also described in XML <?xml version="1.0" encoding="utf-8"?> <view xmlns:android="http://schemas.android.com/apk/res/android" class="com.example.android.notepad.NoteEditor$LinedEditText" android:id="@+id/note" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@android:color/transparent" android:padding="5dip" android:scrollbars="vertical" android:fadingEdge="vertical" android:gravity="top" android:textSize="22sp" android:capitalize="sentences" /> Notepad app (layout of Note-Editor)
Android app development: summary The basic steps of developing an android app: - Develop UML class diagrams, activity diagrams, use-case diagrams … - Identify the activities, services, … - For each activity, decide the GUI and design it, store as resources. - Use the IDE (e.g. Eclipse), and program the Java code for each class - Test & debug the code using the android emulator - Upload the code on the mobile device.
Brief concluding remarks Mobile Operating Systems are in some ways similar to desktop OS, but there are several differences in details, and in usage. Mobile app development process is almost similar to normal app development, but issues such as compiled code size, memory usage and algorithm efficiency are much more important. Several modern mobile OS’s are using xml as an integral part the programming language – e.g. Android (manifest, view layout), Palm Pre OS, …
References and Further Reading Mobile OS wikipedia Google android developer site Next: Project completion, Exam!
Case study: Hangman-style – ‘Save the bird’ game We consider a game similar to the popular ‘Hangman’ game, with the main difference being in the graphics (6 wrong guesses shark eats bird)