0% found this document useful (0 votes)
118 views11 pages

Mobile App

Download as pdf or txt
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 11

Unit 1: Introduction to the Android Platform

LEARNING OUTCOMES
1. Understand the mobile application development process
2. Identify Android operating systems and its advantages
3. Identify the components of the Android Architecture
4. Describe each component of the Android Lecture
Overview
Mobile (Phones and Gadgets)
- Handheld devices - own operating system
Mobile Applications
- Software made for use in mobile devices
- utilities mobile app, games application and so on
Application Design
- process of conceptualizing an application's features, architecture
Application Development
- The process of creating the code
- coding and backend support
Mobile Development Lifecycle
1. Concept/Idea
- this is your proposed concept or an idea to be utilize in mobile development
2. Requirement Analysis
- identify the need of the mobile application
3. Functional Design
- output analysis of your SDLC
- output different features that can be identified through your mobile app
4. Multi-Platform Development
- identify if your mobile application could be develop in a multi+platform
environment or a specific application for a certain OS
5. Cross-Device Testing
- test your application into several devices, different resolution, different screen
sizes and different wearables
6. Release
- involves uploading or publishing your application in the Google play
7. UAT Implementation
- universal implementation of the application. You can also involve here copyright,
application and so on.
8. Publish to Market
- application is now ready for download
Hello Android
- Android​ is an operating system for mobile devices such as smartphones and tablet
computers. Android is also for wearables and embedded systems.
- Android started as a proposed advanced operating system for digital cameras. 190
countries. Largest install
- It was unveiled in 2007 by the Open Handset Alliance
- Currently, under the flagship of Google
- Android has a dominant share of the mobile market of 74.85% as of April 2019
- Android is supported by several smartphone manufacturers such as Sony, Samsung and
others
- Applications are coded in ​Java or Kotlin(Control), XML(Viewpart)
1.0-1.5(Cupcake)
1.6(Donut)
2.0/2.1(Eclair)
2.2(Froyo)
2.3(Gingerbread)
3.0(Honeycomb)
4.0(Ice Cream Sandwich)
4.1-4.3(Jellybean)
4.4(Kitkat)
5.0(Lollipop)
6.0(Marshmallow)
7.0(Nougat)
8.0(Oreo)
9.0(Pie)
Android 10

Why Android?
- Global partnerships and large installed base
- Powerful development framework
- Open marketplace for distributing your apps
The Android Platform
- A software stack for mobile devices: OS kernel, system libraries, application frameworks
and key apps
- Android SDK for creating apps
- Libraries and development tools
- Lots of documentation. Start browsing today!
- See ​http://developerandroid.com
Android Architecture
Linux Kernel - Standard Services
Security
Memory and process management
File and network I/O
Device drivers
Linux Kernel - Android Specific
Power management
Android shared memory
Low memory killer
Interprocess communication
And much more
Libraries
- System C Library
- Bionic libc
- Surface Mgr.:
- Display management
- Media Framework
- Audio/Video
- Webkit
- browser engine
- OpenGL
- Graphics engines
- SQLite
- Relational Database engine
Android Runtime
Two main components
- Core Java Libraries
- Dalvik Virtual Machine
Core Java Libraries
Basic Java Classes -- java.*, javax.*
App Lifecycle -- android.*
Internet/Web Services -- org.*
Unit Testing -- junit.*
Dalvik Virtual Machine
- Apps are executed by the Dalvik Virtual Machine
- Designed for resource-constrained environments
- Slower CPU
- Less RAM
- Limited Battery life
Typical Workflow
- App written in Java (.java) or Kotlin (.kt)
- Compiled to Java/Kotlin bytecode files
- DX converts Java/Kotlin bytecode files to a single DEX bytecode file (classes.dex)
- Dalvik executes dex bytecode file
Application Framework
API Interface
Activity manager - manages application life cycle
Packet manager - keeps tracks of app packages on the device
Window manager - monitors windows compromising an app
View System - provides common user interface elements
Resource Manager - manages non-compiled resources (strings, layouts)
Activity Manager - manages app cycle and navigation stack
Content Provider - enables data sharing
Applications
● Built in user apps
● Can replace built in apps

Unit 2: Android Development Environment


1. Identify the system requirements to run Android Studio
2. Familiarize yourself to setting up Android Studio
3. Download and install Android Studio
4. Demonstrate creating, building and executing project in Android Studio

Overview
Android Studio
- Learning IDE for mobile application development for android
- Introduced in May 2013 but released the Android Studio 1 in December 2014

System Requirements
Operating System:
- Windows 7,8, or 10, 32-bit or 64-bit
- MacOS 10.10 Yosemite or later
Hardware:
- 4 GB RAM minimum; 8 GB recommended
- 2GB Disk space minimum
- 1280 x 800 screen resolution

Unit 3: Application Fundamentals


1. Identify the components of an application
2. Describe each component of an application
3. Identify the process in building an application
4. Demonstrate the steps in creating an application
Application Components
● Activity
● Service
● BroadcastReceiver
● ContentProvider
Applications
● Apps are made from components
● Android instantiates and runs them as needed
● Each component has its own purpose and APIs
Activity
● Primary class for user interaction
● Usually implements a single, focus task that the user can do
Service
● Runs in the background
○ To perform long-running operations
○ To support interaction with remote processes
BroadcastReceiver
● Component that listens for and responds to events
● The subscriber in PUBLISH/SUBSCRIBE pattern
● Events represented by the Intent class and then Broadcast
● BroadcastReceiver receives and responds to Broadcast events
Content Providers
● Store and share data across applications
○ Uses database-style interface
○ Handles interprocess communication
An Application: MapLocation
Features:
- User enters an address
- App displays a map area around the address
Components
- Activity: Search, navigate
- Service: GPS, wi-fi
- BroadcastReceiver: SMS, GPS
- Content Provider: map, address, location

Building an Application
http://developer.android.com/guide

Creating an Android App


1. Define Resources
2. Implement application classes
3. Package Application
4. Install & run application

1. Defining Resources
● Resources are non-source code entities
● Many different resource types, such as
○ Layout, strings, images, menus and animations
● Allow apps to be customized for different devices and users
Strings
● Types: String, String Array, Plurals
● Typically stored in res/values/*.xml
● Specified in XML, e.g ,
○ <string name ="hello"> Hello World! </string>
● Can include formatting and styling
● Accessed by other resources as:
○ @string/string_name
● Accessed in Java/Kotlin as:
○ R.string.string_name
Customizing Strings
If your default language is Italian,
@string/location_string is
“Digita L’indirizzo”
Otherwise,
“Enter Location”

User Interface Layout


● U1 Layout specified in XML files
○ Some tools allow visual layout’
● XMl files typically stored in
○ res/layout/.*xml
● Accessed in Java as:
○ R.layout.layout_name
● Accessed by other resources as
○ @layout/layout_name

Using Multiple Layout Files


● Can specify different layout files based on your device’s orientation, screen size, etc.

R.java
● At compilation, time resources are used to generate the R.java class
● Java code uses the R class to access resources

2. Implement Classes
● Usually involves at least one Activity
● Activity initialization code usually in onCreate()
● Typically onCreate() workflow
○ Restore saved state
○ Set content view
○ Initialize UI elements
○ Link UI elements to code actions
3. Package Applications
● System packages application components and resources into a .APK file
● Developers specify required application information in a file called
AndroidManifest.xml
4. Install and Run
● From Android Studio, run apps in the emulator or device
● From Command line
Enable USB debugging on the device
Settings>Applications>Development>
USB Debugging
Unit 4: Intents
1. Understand the Intent Class
2. Identify the different intent fields
3. Work on multiple activities in an application
4. Demonstrate implicit and explicit starting of activities

The Intent Class


● A data structure that represents
○ An operation to be performed, or
○ An event that has occurred.
Today’s Focus
● Using Intents to specify operations to be performed not for event notification
○ I.e, Intents used to start a single activity
Intents as Desired Operations
● Intents provide a flexible language for specifying operations to be performed
○ Pick a contact
○ Take a photo
○ Dial a phone number
Intents as Desired Operations
● Intent is constructed by one component that wants some work done
● Received by one activity that can perform that work
Intent Fields
● Action
● Data
● Category
● Type
● Component
● Extras
● Flags
Action
● String representing desired operation
Examples
● ACTION_DIAL - dial a number
● ACTION_EDIT - Display data to edit
● ACTION_SYNC - Synchronize device data with server
● ACTION_MAIN - Start as initial activity of app
Setting the Intent Action
val newInt = Intent(Intent.ACTION_DIAL)
or
val newInt = Intent(this)
newInt.setAction(Intent.ACTION_DIAL)
Data
Data associated with the Intent
● Formatted as a Uniform Resource Identifier (URI)

Data Example
Data to view on a map
● Uri.parse(“geo:0,0?q=1600+Pennsylvania+Ave+Washington+DC”)
Number to dial in the phone dialer
● Uri.parse(“tel:+15555555555”)
Setting Intent Data
val newInt = Intent(Intent.ACTION_DIAL,
Uri.parse(“tel:+15555555555))
or
val newInt = Intent(Intent.ACTION_DIAL)
newInt.setData(Uri.parse(“tel:+15555555555))
Category
● Additional Information about the components that can handle the Intent
● CATEGORY_BROWSABLE – can be invoked by a browser to display data ref’s by a
URI
● CATEGORY_LAUNCHER – can be initial activity of a task and is listed in top-level
app launcher.
● CATEGORY_DEFAULT - can be invoked for multiple activities
Type
Specifies the MIME type of the Intent data
Examples:
● Image/*.image/png. Img, image/jpg
● Text/Plain, Text/HTML
● If unspecified, Android will infer the type
Setting the type
Intent.setType(String type)
or
Intent.setDataAndType(Uri data, String type)
Component
● The component that should receive this intent
● Use this when there’s exactly one component that should receive the intent
Setting the component
val newInt =
Intent (Context packageContext,
Class<?>cls)
val newInt =
Intent (this, DestinationActivity::class.java)

Extras
Additional information associated with Intent treated as a map (key-value pairs)

Examples
Intent.EXTRA_EMAIL: email recipients
val newInt = Intent(Intent.ACTION_SEND);
newInt.putExtra(android.content.Intent.EXTRA_EMAIL, new String[]{
[email protected]”,
“​[email protected]​”}}
Setting the Extra attribute
Several forms depending on data types:
● putExtra(String name, String value);
● putExtra(String name, float[] value);
Flags
Specify how Intent should be handled
● FLAG_ACTIVITY_NO_HISTORY
Don’t put this Activity in the history stack
● FLAG_DEBUG_LOG_RESOLUTION
Print extra logging information when this Intent is processed
Setting Flags
val newInt = Intent(Intent.ACTION_SEND);
newInt.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
Today’s Topics
● The Intent Class
● Starting Activities with Intents
○ Explicit Activation
○ Implicit Activation via Intent Resolution
Starting Activities with Intents
● startActivity(Intent intent,…)
● startActivityForResult(
Intent intent,…)
The Target Activity
● Can be named explicitly by setting the intent’s component
● Can be determined implicitly
Explicit Activation
● HelloWorldWithLogin
● Two Activities
○ LoginActivity checks username and password and then starts
HelloAndroidActivity
○ HelloAndroidActivity shows “hello android” message
Implicit Activation
● When the Activity to be activated is not explicitly named, Android tries to find activities
that match the intent
● This process is called Intent Resolution
Intent Resolution Process
● An Intent describing a desired operation
● IntentFilters which describe which operations an Activity can handle
Specified either in AndroidManifest.XML or programmatically

Specifying IntentFilters
<activity ….>
<intent-filter ….>
…….
<action android:name = “actionName”/>
</intent-filter >
</activity>
Handling Intent.ACTION_DIAL
<activity ….>
<intent-filter ….>
…….
<action android:name = “android.intent.action.DIAL”/>
</intent-filter >
</activity>
Adding Data to IntentFilter
<intent-filter ….>
…….
<data android:mimeType=“string”
android:scheme=“string”
android:host=“string”
android:port=“string”
android:path=“string”
android:pathPattern=“string”
android:pathPrefix=“string”
/>
</intent-filter>
Handling Geo: Scheme Intents
<intent-filter ….>
…….
<data android:scheme=“geo”/>
……..
</intent-filter>
Handling A Category to IntentFilter
<intent-filter ….>
…….
<category android:name=“name”/>
……..
</intent-filter>
Example: Maps Application
<intent-filter ….>
<action android:name = “android.intent.action.VIEW”>
<category android:name = “android.intent.category.DEFAULT”>
<category android name = “android.intent.category.BROWSABLE”>
<data android:scheme =“geo”/>
</intent-filter>
Receiving Implicit Intents
To receive implicit intents, an activity should specify an IntentFilter
with the category:
● “android.intent.category.DEFAULT”

Unit 5: User Interface Design for Android


Learning Outcomes
1. Understand views and viewgroups as components in UI design
2. Identify the subclasses of View and ViewGroup
3. Apply event handling to views and viewgroups
4. Demonstrate the application of View and ViewGroups subclasses in an application
User Interface and Navigation
Apps user interface
- everything that user can see and interact with
Android provides a variety of prebuilt UI components
- structured layout objects
- UI controls
- UI modules for special interfaces
View
K

You might also like