Mobile App
Mobile App
Mobile App
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
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
Building an Application
http://developer.android.com/guide
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”
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
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”