introduction to android - tkk · 2013-06-25 · native c and c++ code for android ! high...

31
Introduction to Android T-110.5130 Mobile Systems Programming

Upload: others

Post on 11-Jul-2020

8 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Introduction to Android - TKK · 2013-06-25 · Native C and C++ code for Android ! High performance but not so portable ! Compile at least for ARM, preferably for x86 and MIPS !

Introduction to Android T-110.5130 Mobile Systems Programming

Page 2: Introduction to Android - TKK · 2013-06-25 · Native C and C++ code for Android ! High performance but not so portable ! Compile at least for ARM, preferably for x86 and MIPS !

Credits

!   Lecture and slides inspired by presentation given by Claudio Camacho and Ramon Sadornil from Android Aalto

! androidaalto.org

! www.claudiocamacho.com

! www.jush.org

30.1.2013 Kimmo Ahokas 2

Page 3: Introduction to Android - TKK · 2013-06-25 · Native C and C++ code for Android ! High performance but not so portable ! Compile at least for ARM, preferably for x86 and MIPS !

Content

!   Android background

!   Design

!   Developing for Android

!   Android API

30.1.2013 Kimmo Ahokas 3

Page 4: Introduction to Android - TKK · 2013-06-25 · Native C and C++ code for Android ! High performance but not so portable ! Compile at least for ARM, preferably for x86 and MIPS !

What is Android?

!   The world’s most popular mobile platform

!   675 000 Apps available in Google Play Store

!   First phone in 2008

!   Linux kernel

! Dalvik virtual machine

30.1.2013 Kimmo Ahokas 4

Page 5: Introduction to Android - TKK · 2013-06-25 · Native C and C++ code for Android ! High performance but not so portable ! Compile at least for ARM, preferably for x86 and MIPS !

Android runs everywhere!

30.1.2013 Kimmo Ahokas 5

Page 6: Introduction to Android - TKK · 2013-06-25 · Native C and C++ code for Android ! High performance but not so portable ! Compile at least for ARM, preferably for x86 and MIPS !

Android

!   Developed by Google

!   Open source

!   Free to use

!   Free SDK

30.1.2013 Kimmo Ahokas 6

Page 7: Introduction to Android - TKK · 2013-06-25 · Native C and C++ code for Android ! High performance but not so portable ! Compile at least for ARM, preferably for x86 and MIPS !

Android Market

!   Easiest way to distribute software !   Not the only way

!   25€ starting fee

!   Income shared 70/30

!   No approval process, apps published in hours

!   In-app billing possible

30.1.2013 Kimmo Ahokas 7

Page 8: Introduction to Android - TKK · 2013-06-25 · Native C and C++ code for Android ! High performance but not so portable ! Compile at least for ARM, preferably for x86 and MIPS !

Software versions

30.1.2013 Kimmo Ahokas 8

Page 9: Introduction to Android - TKK · 2013-06-25 · Native C and C++ code for Android ! High performance but not so portable ! Compile at least for ARM, preferably for x86 and MIPS !

Design

30.1.2013 Kimmo Ahokas 9

Page 10: Introduction to Android - TKK · 2013-06-25 · Native C and C++ code for Android ! High performance but not so portable ! Compile at least for ARM, preferably for x86 and MIPS !

Design Principles

!   Enchant Me

!   Simplify My Life

!   Make Me Amazing

30.1.2013 Kimmo Ahokas 10

Page 11: Introduction to Android - TKK · 2013-06-25 · Native C and C++ code for Android ! High performance but not so portable ! Compile at least for ARM, preferably for x86 and MIPS !

Style

!   Flexible layouts

!   Themes

!   Feedback

!   Colors

!   Fonts

!   Icons

30.1.2013 Kimmo Ahokas 11

Page 12: Introduction to Android - TKK · 2013-06-25 · Native C and C++ code for Android ! High performance but not so portable ! Compile at least for ARM, preferably for x86 and MIPS !

Patterns

!   Consistent user experience

!   Action Bar

!   Compatibility

!   Accessibility

!   Pure Android

30.1.2013 Kimmo Ahokas 12

Page 13: Introduction to Android - TKK · 2013-06-25 · Native C and C++ code for Android ! High performance but not so portable ! Compile at least for ARM, preferably for x86 and MIPS !

Building Blocks

!   Ready-to-use elements

!   Tabs

!   Lists

!   Selectors

!   Dialogs

!   Progress

30.1.2013 Kimmo Ahokas 13

Page 14: Introduction to Android - TKK · 2013-06-25 · Native C and C++ code for Android ! High performance but not so portable ! Compile at least for ARM, preferably for x86 and MIPS !

Developing for Android

30.1.2013 Kimmo Ahokas 14

Page 15: Introduction to Android - TKK · 2013-06-25 · Native C and C++ code for Android ! High performance but not so portable ! Compile at least for ARM, preferably for x86 and MIPS !

Android SDK

!   Based on Eclipse and ADT plugin

!   Android SDK Tools

!   Android Platform-tools

!   Android Platform

!   Android system image for emulator

!   Get it: http://developer.android.com/sdk/index.html

30.1.2013 Kimmo Ahokas 15

Page 16: Introduction to Android - TKK · 2013-06-25 · Native C and C++ code for Android ! High performance but not so portable ! Compile at least for ARM, preferably for x86 and MIPS !

Other development options

!   Not supported by Google or this course !   You can still use them if you want to

! IntelliJ IDEA !   Alternative for Eclipse

!   Vim, emacs and other text editors !   Download Android sdk tools and use Ant for building

30.1.2013 Kimmo Ahokas 16

Page 17: Introduction to Android - TKK · 2013-06-25 · Native C and C++ code for Android ! High performance but not so portable ! Compile at least for ARM, preferably for x86 and MIPS !

Project Structure

30.1.2013 Kimmo Ahokas 17

!   Android Manifest

!   Source files

!   Binaries (NDK)

!   Libraries

!   Resources

Page 18: Introduction to Android - TKK · 2013-06-25 · Native C and C++ code for Android ! High performance but not so portable ! Compile at least for ARM, preferably for x86 and MIPS !

Android Emulator

!   Run any version of Android

!   All different screen sizes available

!   Limit network speed

!   Emulate phone calls and sms messages

!   Screenshots

!   Mock locations

!   Lot more stuff hidden

30.1.2013 Kimmo Ahokas 18

Page 19: Introduction to Android - TKK · 2013-06-25 · Native C and C++ code for Android ! High performance but not so portable ! Compile at least for ARM, preferably for x86 and MIPS !

Devices

!   Testing with real device

!   Enable USB debugging

!   Drivers !   OS X has built in drivers

!   In windows different drivers for every device

30.1.2013 Kimmo Ahokas 19

Page 20: Introduction to Android - TKK · 2013-06-25 · Native C and C++ code for Android ! High performance but not so portable ! Compile at least for ARM, preferably for x86 and MIPS !

Debugging

!   Debugger

!   Test Framework

!   Code coverage

! Monkeyrunner

30.1.2013 Kimmo Ahokas 20

Page 21: Introduction to Android - TKK · 2013-06-25 · Native C and C++ code for Android ! High performance but not so portable ! Compile at least for ARM, preferably for x86 and MIPS !

Android API

30.1.2013 Kimmo Ahokas 21

Page 22: Introduction to Android - TKK · 2013-06-25 · Native C and C++ code for Android ! High performance but not so portable ! Compile at least for ARM, preferably for x86 and MIPS !

Activity

30.1.2013 Kimmo Ahokas 22

Page 23: Introduction to Android - TKK · 2013-06-25 · Native C and C++ code for Android ! High performance but not so portable ! Compile at least for ARM, preferably for x86 and MIPS !

Fragment

30.1.2013 Kimmo Ahokas 23

Page 24: Introduction to Android - TKK · 2013-06-25 · Native C and C++ code for Android ! High performance but not so portable ! Compile at least for ARM, preferably for x86 and MIPS !

Intent

!   Start other activities !   Even activities that are

not part of your own app!

!   Maybe the most powerful feature of Android

!   Share stuff via any installed app

!   Offer services for other apps

30.1.2013 Kimmo Ahokas 24

Page 25: Introduction to Android - TKK · 2013-06-25 · Native C and C++ code for Android ! High performance but not so portable ! Compile at least for ARM, preferably for x86 and MIPS !

Notifications

!   Inform users about events in your app

!   Jelly Bean added basic interaction

30.1.2013 Kimmo Ahokas 25

Page 26: Introduction to Android - TKK · 2013-06-25 · Native C and C++ code for Android ! High performance but not so portable ! Compile at least for ARM, preferably for x86 and MIPS !

Network

! HttpUrlConnection

! Never use any network api in your main thread! !   The UI hangs on older versions

!   Android 3.0 and later won’t allow it at all

30.1.2013 Kimmo Ahokas 26

Page 27: Introduction to Android - TKK · 2013-06-25 · Native C and C++ code for Android ! High performance but not so portable ! Compile at least for ARM, preferably for x86 and MIPS !

Location

!   Locate user

!   Fine vs. Coarse location

!   Google Maps API

30.1.2013 Kimmo Ahokas 27

Page 28: Introduction to Android - TKK · 2013-06-25 · Native C and C++ code for Android ! High performance but not so portable ! Compile at least for ARM, preferably for x86 and MIPS !

Native Development Kit

!   Native C and C++ code for Android

!   High performance but not so portable

!   Compile at least for ARM, preferably for x86 and MIPS

!   Adds complexity, try to avoid NDK

!   If Android API provides something, use it instead of NDK

!   Signal processing, physics

30.1.2013 Kimmo Ahokas 28

Page 29: Introduction to Android - TKK · 2013-06-25 · Native C and C++ code for Android ! High performance but not so portable ! Compile at least for ARM, preferably for x86 and MIPS !

Other Things

!   Android Support Library

!   API examples

!   Project & Activity templates

! ActionBarSherlock

30.1.2013 Kimmo Ahokas 29

Page 30: Introduction to Android - TKK · 2013-06-25 · Native C and C++ code for Android ! High performance but not so portable ! Compile at least for ARM, preferably for x86 and MIPS !

Excellent sources

! http://developer.android.com/index.html

! http://www.androiduipatterns.com/

! http://www.androidpatterns.com/

! http://androidaalto.org/

30.1.2013 Kimmo Ahokas 30

Page 31: Introduction to Android - TKK · 2013-06-25 · Native C and C++ code for Android ! High performance but not so portable ! Compile at least for ARM, preferably for x86 and MIPS !

Contact

!   Questions Concerning Android project in Mobile Systems Programming course?

!   IRC: KimiA @IRCnet (probably fastest)

!   Mail: [email protected]

30.1.2013 Kimmo Ahokas 31