Engineering and Industrial Mobile Application (APP) Development

30
Technology Training that Works Technology Training that Works www.idc-online.com/slideshare Engineering and Industrial Mobile Application (App) Development

description

FOR MORE INFORMATION: http://idc-online.com/slideshare

Transcript of Engineering and Industrial Mobile Application (APP) Development

Page 1: Engineering and Industrial Mobile Application (APP) Development

Technology Training that WorksTechnology Training that Workswww.idc-online.com/slideshare

Engineering and Industrial Mobile Application (App) Development

Page 2: Engineering and Industrial Mobile Application (APP) Development

Technology Training that WorksTechnology Training that Workswww.idc-online.com/slideshare

Day 3

Day 2

Day 1

Topics• Introduction• Environment Setup• Basic Project

– Starting Out

– User Interface Design

– Coding and Behaviour

– Android Resources and Feeds

– Long-running processes

– Creating Home Screen Widgets

– Publishing to Play Store

• Advanced Development– Task Reminders

– Menu Design and Lists

– User Input

– Dynamic & Multi-Pane UI

– Relative Layout

– Persistent Data Storage

– Alarm Manager

• Advanced Development cont.– Status Bar Updates

– Preferences Framework

– Multi-Device Support and Tablet Development

– Porting to tablets

– Beyond Google

Page 3: Engineering and Industrial Mobile Application (APP) Development

Technology Training that WorksTechnology Training that Workswww.idc-online.com/slideshare

Android:• An operating system

• was designed for mobile, touch-screen devices

• is Linux-based

• uses open source code

• can be connected to other devices

• Android Inc. established in 2003– at the time, for non-touch

devices

IntroductionBackground, history of app development

• Google buys Android Inc 2005

• Apple iPhone released in 2007

• Open Handset Alliance formed in 2007– manufacturers of H/W and S/W

• Android SDK released in 2008

• First Android phones released

Page 4: Engineering and Industrial Mobile Application (APP) Development

Technology Training that WorksTechnology Training that Workswww.idc-online.com/slideshare

IntroductionBackground, history of app development

Year Version Name API Distribution

2008 1.6 Donut 4 0.1%

Source: Murach’s Android Programming, 2013 (Author: Joel Murach)

2009 2.1 Eclair 7 1.7%

2010 2.2 Froyo 8 4.0%

2010 2.3-2.3.2 Gingerbread 9 0.1%

2010 2.3.3-2.3.7 Gingerbread 10 39.7%

2011 3.2 Honeycomb 13 0.2%

2011 4.0.3-4.0.4 Ice cream sandwich

15 29.3%

2012 4.1 Jelly bean 16 23.0%

2012 4.2 17 2.0%

2013 4.3 18 0%

Page 5: Engineering and Industrial Mobile Application (APP) Development

Technology Training that WorksTechnology Training that Workswww.idc-online.com/slideshare

Introduction

Why develop for Android?

– Free & open O/S

– Big market share

– Multi-device

– Maintained by Google

– Manufacturer participation

– Existing marketplace

– Short time to market

The latest figures ...

Android taking up 81% of the marketiOS at 16% Windows Phone 3%”

Preston Gralla ComputerWorld, May 13, 2014

Page 6: Engineering and Industrial Mobile Application (APP) Development

Technology Training that WorksTechnology Training that Workswww.idc-online.com/slideshare

Introduction

Why develop for Android?

– Accessory supportOpen Accessory Support

allows

external USB hardware

to interact with

an Android device

Page 7: Engineering and Industrial Mobile Application (APP) Development

Technology Training that WorksTechnology Training that Workswww.idc-online.com/slideshare

Introduction• Features

– Java– Intents (Action + Data)– Cursor-less controls– View– Multi operations / threads– Background services– Fragments– Loaders– Support Library– Action Bar– Widgets– Touch-screen– Sensors– Multimedia– Security– Online

Page 8: Engineering and Industrial Mobile Application (APP) Development

Technology Training that WorksTechnology Training that Workswww.idc-online.com/slideshare

Introduction

Page 9: Engineering and Industrial Mobile Application (APP) Development

Technology Training that WorksTechnology Training that Workswww.idc-online.com/slideshare

Requirements

• Java programming knowledge

• Understanding of XML

• Computer hardware and software:– 1.6GHz– 1GB RAM– 3GB HDD space– Windows XP– Mac OS X 10.5.8– Ubuntu Linux

Page 10: Engineering and Industrial Mobile Application (APP) Development

Technology Training that WorksTechnology Training that Workswww.idc-online.com/slideshare

• IDE

• SDK

• ADT

• AVD

Terminology

- Integrated Development Environment

- Software Development Kit

- Android Development Tool (plug-in)

- Android Virtual Device (Emulator)

Page 11: Engineering and Industrial Mobile Application (APP) Development

Technology Training that WorksTechnology Training that Workswww.idc-online.com/slideshare

Configure Android SDK

and ADT

Install and run Eclipse

Install Android & Eclipse

components

Write java code in Eclipse

Emulate the output

Run on an Android device

Android Development & Deployment

Page 12: Engineering and Industrial Mobile Application (APP) Development

Technology Training that WorksTechnology Training that Workswww.idc-online.com/slideshare

New Android project

• In Eclipse start a New Android Project

Page 13: Engineering and Industrial Mobile Application (APP) Development

Technology Training that WorksTechnology Training that Workswww.idc-online.com/slideshare

New Android application fieldsApplication Name: The name that users will see

Project Name: Internal project & folder names

Package Name: Package namespace for Java programming

Minimum Req SDK: Minimum version support

Target SDK: Highest version tested

Compile With: Version used to compile the app.

Theme: User Interface style

Page 14: Engineering and Industrial Mobile Application (APP) Development

Technology Training that WorksTechnology Training that Workswww.idc-online.com/slideshare

Create a new project Create custom launcher icon:The icon used to start the app

Create activityMakes a default “activity” (User Interface)

Mark this project as a libraryTo be used for importing into other apps

Create project in WorkspaceUse the default workspace or another

Working sets:Eclipse can use Working Sets to groups projects

Page 15: Engineering and Industrial Mobile Application (APP) Development

Technology Training that WorksTechnology Training that Workswww.idc-online.com/slideshare

Starting Out

• Configure Launcher Icon

• A set of four generalized densities:

– ldpi (low), – mdpi(medium),– hdpi (high), and – xhdpi (extra high)

Page 16: Engineering and Industrial Mobile Application (APP) Development

Technology Training that WorksTechnology Training that Workswww.idc-online.com/slideshare

Aside: Supporting multiple screensDensity-independent pixelssmall screens are at least 426dp x 320dp

normal screens are at least 470dp x 320dp

large screens are at least 640dp x 480dp

xlarge screens are at least 960dp x 720dpA set of four generalized densities:

ldpi (low), mdpi(medium),hdpi (high), and xhdpi (extra high)

Page 17: Engineering and Industrial Mobile Application (APP) Development

Technology Training that WorksTechnology Training that Workswww.idc-online.com/slideshare

Activity template

Blank: Standard action bar, and navigation tabs

Full screen: Toggles UI visibility on user interaction

Master/Detail Flow: Collection of objects / menu with details for each object. Tablets and handsets

Page 18: Engineering and Industrial Mobile Application (APP) Development

Technology Training that WorksTechnology Training that Workswww.idc-online.com/slideshare

Starting OutActivity Name: Name of activity class

Layout Name: Layout name for activity layout

Fragment Layout: The name of the content fragment

Navigation Type: The type of navigation to use – Swipe, Action bar tabs, Action bar spinner, and Navigation drawer.

Page 19: Engineering and Industrial Mobile Application (APP) Development

Technology Training that WorksTechnology Training that Workswww.idc-online.com/slideshare

Starting Out

• Auto-generated filesApp behaviour (src): Actions coded in Java

gen: Java code generated as app is developed

Android: Default Android libraries

Assets: Images, raw binary assets

Bin, libs: referencing third party libraries

Resources (res): UI layouts, strings, colours, etc. defined in XML (External)

Config files: General configuration of app resource integration

Page 20: Engineering and Industrial Mobile Application (APP) Development

Technology Training that WorksTechnology Training that Workswww.idc-online.com/slideshare

Auto-generated java class

Navigate to the code

Page 21: Engineering and Industrial Mobile Application (APP) Development

Technology Training that WorksTechnology Training that Workswww.idc-online.com/slideshare

Android Development with Eclipse

The Wizard creates an override of the onCreate method of Activity

buttonAct is a sub-class of Activity

Page 22: Engineering and Industrial Mobile Application (APP) Development

Technology Training that WorksTechnology Training that Workswww.idc-online.com/slideshare

Activities

• The main Activity class is a child of the Activity parent class

• An Activity is a single entity that is used to perform actions

• An app may have many separate activities– the user interacts with them one at a time

• onCreate() is the default method called by the Android system when your Activity starts

– it is where you should perform all initialization and User Interaction setups

• An Activity usually has a user interface

Page 23: Engineering and Industrial Mobile Application (APP) Development

Technology Training that WorksTechnology Training that Workswww.idc-online.com/slideshare

• The output will come from default values in the class “R”• More on “R” later• First let’s run the code

Where are the values?

Page 24: Engineering and Industrial Mobile Application (APP) Development

Technology Training that WorksTechnology Training that Workswww.idc-online.com/slideshare

Run the code

Run the application

Page 25: Engineering and Industrial Mobile Application (APP) Development

Technology Training that WorksTechnology Training that Workswww.idc-online.com/slideshare

Run as Android

Application

Page 26: Engineering and Industrial Mobile Application (APP) Development

Technology Training that WorksTechnology Training that Workswww.idc-online.com/slideshare

Emulating the output• Run app using the “Run” button

• The emulator will automatically start the Hello World app

• Alternatively you can Start the Emulator from the AVD Manager

Page 27: Engineering and Industrial Mobile Application (APP) Development

Technology Training that WorksTechnology Training that Workswww.idc-online.com/slideshare

Emulator

The Eclipse plugin:•automatically creates a new run configuration for your project •& launches the Emulator

The emulator might take several minutes to boot

When the emulator is booted, the Eclipse plugin:•installs your application and•launches the default Activity

Page 28: Engineering and Industrial Mobile Application (APP) Development

Technology Training that WorksTechnology Training that Workswww.idc-online.com/slideshare

Emulator

The text below is also a String found in strings.xml

The text in the grey bar is the application title

•The Eclipse plugin creates this text automatically

•The string is defined in res/values/strings.xml & referenced by AndroidManifest.xml

Page 29: Engineering and Industrial Mobile Application (APP) Development

Technology Training that WorksTechnology Training that Workswww.idc-online.com/slideshare

Copy .apk to device

You could copy the app to a device and run it …

Page 30: Engineering and Industrial Mobile Application (APP) Development

Technology Training that WorksTechnology Training that Workswww.idc-online.com/slideshare

DO YOU WANT TO KNOW MORE?

If you are interested in further training or information, please visit:

http://idc-online.com/slideshare