Mobile App Development Overview
Mobile App Development Overview
runtime and a bridge for native device APIs via Apache Cordova.
Mobile Application Development
Progressive Web Applications
Mobile application development is the process of creating software applications that run
on a mobile device, and a typical mobile application utilizes a network connection to work PWAs offer an alternative approach to traditional mobile app development by skipping
with remote computing resources. Hence, the mobile development process involves app store delivery and app installations. PWAs are web applications that utilize a set of
creating installable software bundles (code, binaries, assets, etc.), implementing backend browser capabilities - such as working offline, running a background process, and adding
services such as data access with an API, and testing the application on target devices. a link to the device home screen to provide an 'app like' user experience.
Mobile Applications and Device Platforms WHAT IS ANDROID?
There are two dominant platforms in the modern smartphone market. One is the iOS Android is a mobile operating system that is based on a modified version of Linux .
platform from Apple Inc. The iOS platform is the operating system that powers Apple's Android is an open source and Linux-based Operating System for mobile devices such as
popular line of iPhone smartphones. The second is Android from Google. The Android smartphones and tablet computers.
operating system is used not only by Google devices but also by many other OEMs to build
Android is called as “the first complete, open, and free mobile platform”:
their own smartphones and other smart devices.
Complete: allows for rich application development opportunities.
Alternatives for Building Mobile Apps
Open: It is provided through open-source licensing.
There are four major development approaches when building mobile applications
Free: Android applications are free to develop.
• Native Mobile Applications
THE ANDROID VERSION
• Cross-Platform Native Mobile Applications
• Hybrid Mobile Applications
• Progressive Web Applications
Each of these approaches for developing mobile applications has its own set of
advantages and disadvantages. When choosing the right development approach for their
projects, developers consider the desired user experience, the computing resources and
native features required by the app, the development budget, time targets, and resources
available to maintain the app.
Native Applications
Native mobile applications are written in the programming language and
frameworks provided by the platform owner and running directly on the operating system
of the device such as iOS and Android.
Cross-Platform Applications
Cross-platform native mobile applications can be written in variety of different
programming languages and frameworks, but they are compiled into a native application
running directly on the operating system of the device.
Hybrid-Web Applications
Hybrid mobile applications are built with standard web technologies - such as Operating Systems
JavaScript, CSS, and HTML5 - and they are bundled as app installation packages. Contrary
Different OS run on different types of hardware and are designed for different types of ➢ Multi-tasking —Supports multi-tasking applications
applications. For example, iOS is designed for iPhones and iPad tablets, while Mac ➢ Flash support —Android 2.3 supports Flash 10.1.
desktops and laptops use macOS. ➢ Tethering —Supports sharing of Internet connections as a wired/wireless hotspot
Microsoft Windows
Initial versions of Windows worked with MS-DOS, providing a modern graphical interface Architecture of Android
on top of DOS's traditional text-based commands. The Windows Start menu helps users
find programs and files on their devices.
APPLE IOS
Apple's iOS is one of the most popular smartphone operating systems, second only to
Android. It runs on Apple hardware, including iPhones, iPad tablets and iPod Touch media
players.
GOOGLE'S ANDROID OS
Android is the most popular operating system in the world judging by the number of
devices installed. Users can download custom versions of the operating system.
APPLE MAC OS
Apple's macOS, successor to the popular OS X operating system, runs on Apple laptops
and desktops. MacOS is known for its user-friendly features, which include Siri and
FaceTime.
LINUX OPERATING SYSTEM
Linux can be run on a wide variety of hardware and is available free of charge over the
internet.
Features of Android
Because Android is open source and freely available to manufacturers for customization,
there are no fixed hardware or software configurations. However, Android itself supports
the following features
➢ Storage —Uses SQLite, a lightweight relational database, for data storage.
➢ Connectivity —Supports GSM/EDGE, IDEN, CDMA, EV-DO, UMTS, Bluetooth
(includes A2DP and AVRCP), Wi-Fi, and WiMAX Linux kernel
➢ Messaging —Supports both SMS and MMS. This is the kernel on which Android is based. This layer contains all the low-level device
➢ Web browser —Based on the open-source WebKit, together with Chrome’s V8 drivers for the various hardware components of an Android device.
JavaScript engine
➢ Media support —Includes support for the following media: H.263, H.264 (in 3GP or
MP4 container), MPEG-4 SP, AMR, AMR-WB (in 3GP container), AAC, HE-AAC (in
MP4 or 3GP container), MP3, MIDI, WAV, JPEG, PNG, GIF, and BMP
➢ Hardware support —Accelerometer Sensor, Camera, Digital Compass, Proximity
Sensor, and GPS
➢ Multi-touch —Supports multi-touch screens
The Application Framework is a set of services that collectively form the environment in
which Android applications run and are managed. Exposes the various capabilities of the
Android OS to application developers so that they can make use of them in their
applications.
Applications
Libraries
At this top layer, you will find applications that ship with the Android device (such as
These contain all the code that provides the main features of an Android OS. For example, Phone, Contacts, Browser, etc.), as well as applications that you download and install
the SQLite library provides database support so that an application can use it for data from the Android Market. Any applications that you write are located at this layer.
storage. The WebKit library provides functionalities for web browsing.
The Android runtime also includes the Dalvikvirtual machine, which enables every Android ➤Internet TVs
application to run in its own process, with its own instance of the Dalvikvirtual machine
(Android applications are compiled into Dalvikexecutables).
Dalvikis a specialized virtual machine designed specifically for Android and optimized for
battery-powered mobile devices with limited memory and CPU.
The Dalvik VM makes use of Linux core features like memory management
and multithreading, which is intrinsic in the Java language.
Application framework
Click green button “Download Android Studio for Windows” it will open following page.
➢ Installing JDK
Double click downloaded JDK Installation file and follow instructions on screen.
Accept term and condition at the bottom and press blue button “Download Android
Studio for Windows”. It will start downloading android studio for windows. Do not start
installation before downloading and installing JDK 1.7 is over.
➢ Downloading JDK
To download JDK 1.7 type following URL in browser.
[Link]
[Link]. It will open page shown below
After installation starts it will asks for Java Runtime Environment (JRE) Installation
location.
Specify path for Android Studio Installation and Android SDK Installation or use
default and press Next button
Click on Finish button to launch Android Studio. It will display following screen
Press Install Button. This will start installation as shown below.
Select last option and press OK. It will download updates and create virtual device
for you.
Press next button to finish installation and launch Android Studio. Press finish button to start Android Studio with following initial welcome screen.
Launching Android Studio To Create an Android Project
1. Open Android Studio if it is not already opened.
2. In the main Welcome to Android Studio window, click Start a new Android Studio
project. (If you don't have a project opened, in the Welcome screen, click New
[Link] If you have a project opened, from the File menu, select New Project).
Important Note:On some Windows systems, the launcher script does not find where Java is
installed. If you encounter this problem, you need to set an environment variable indicating the
correct location. Select Start menu > Computer > System Properties > Advanced System 3. In the Create Android Project window, enter Hello World for the Application name.
Properties. Then open Advanced tab > Environment Variables and add a new system variable 4. Verify that the default Project location is where you want to store your Hello World app
JAVA_HOME that points to your JDK folder, for example C:\Program Files\Java\jdk1.7.0_XX. and other Android Studio projects, or change it to your preferred directory.
5. Accept the default [Link] for Company Domain, or create a unique
company domain. If you are not planning to publish your app, you can accept the default.
6. click Next.
7. On the Target Android Devices screen, Phone and Tablet should be selected. Ensure
that API 15: Android 4.0.3 IceCreamSandwich is set to Minimum SDK; if not, use the
popup menu to set it. These are the settings. As of this writing, these settings make Hello
World app compatible with 97% of Android devices active on the Google Play Store.
8. Leave unchecked the Include Instant App support and all other options. Then click
Next. If your project requires additional components for your chosen target SDK,
Android Studio will install them automatically.
[Link] Configure Activity screen appears (which differs depending on which template you
chose in the previous step). By default, the empty Activity provided by the template is
named MainActivity. You can change this if you want, but this lesson uses MainActivity.
[Link] sure that the Generate Layout file option is checked. The layout name by default
9. The Add an Activity window appears. An Activity is a single, focused thing that the user is activity_main. You can change this if you want, but this lesson uses activity_main.
can do. It is a crucial component of any Android app. An Activity typically has a layout [Link] sure that the Backwards Compatibility (App Compat) option is checked. This
associated with it that defines how UI elements appear on a screen. Android Studio ensures that your app will be backwards-compatible with previous versions of Android.
provides Activity templates to help you get started. For the Hello World project, choose [Link] Finish.
Empty Activity as shown below, and click Next.
In the new version of Android Studio, the steps for creating an application are as shown in
the pictures
An application can have zeroor moreactivities; in this example, the application contains
oneactivity: HelloWorldActivity. This HelloWorldActivity is the entry point of the application,
which is displayed when the application is started.
An activity is implemented as a subclass of AppCompatActivity class as follows:
package [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
[Link](savedInstanceState);
[Link](this);
setContentView([Link].activity_main);
[Link](findViewById([Link]), (v, insets) -> {
Insets systemBars = [Link]([Link]()); ➢ Content Providers
[Link]([Link], [Link], [Link], [Link]); allow data exchange between applications.
return insets; A content provider component supplies data from one application to others on request.
}); Such requests are handled by the methods of the ContentResolver class. The data may be
} stored in the file system, the database or somewhere else entirely. A content provider is
} implemented as a subclass of ContentProvider class and must implement a standard set of
APIs that enable other applications to perform transactions.
➢ Services
They handle background processing associated with an application. There are additional components which will be used in the construction of above mentioned
Services–no visual interface –they run in the background entities, their logic, and wiring between them. These components are:
A service is a component that runs in the background to perform long-running operations.
For example, a service might play music in the background while the user is in a different ➢ View
application, or it might fetch data over the network without blocking user interaction with All user interface elements in an Android app are built using Viewand ViewGroupobjects.
an activity. A service is implemented as a subclass of Service class as follows: A Viewis an object that draws something on the screen that the user can interact with. A
ViewGroup is an object that holds other View(and ViewGroup) objects in order to define
package [Link]; the layout of the interface.
import [Link]; ➢ Layouts
import [Link]; View hierarchies that control screen format and appearance of the views.
import [Link]; ➢ [Link]
public class MyService extends Service { Configuration file for the application. This is the manifest file for your Android
public MyService() { application. Here you specify the permissions needed by your application, as well as
} other features (such as intent-filters,receivers, etc.).
@Override
public IBinder onBind(Intent intent) {
// TODO: Return the communication channel to the service.
throw new UnsupportedOperationException("Not yet implemented");
}
}
➢ Broadcast Receivers
They handle communication between Android OS and applications.
receive and react to broadcast announcements.
Broadcast Receivers simply respond to broadcast messages from other applications or
from the system. For example, applications can also initiate broadcasts to let other
applications know that some data has been downloaded to the device and is available for
them to use, so this is broadcast receiver who will intercept this communication and will
initiate appropriate action.
A broadcast receiver is implemented as a subclass of BroadcastReceiver class and each
message is broadcasted as an Intent object.
public class MyReceiver extends BroadcastReceiver
{
}
Add a Button
1. In Android Studio, from the res/layout directory, edit the activity_my.xml [Link] the
<LinearLayout> element, define a <Button> element immediately following the
<EditText> element.
2. Set the button's width and height attributes to "wrap_content" so the button is only as big
as necessary to fit the button's text label.
3. Define the button's text label with the android:text attribute; set its value to the
button_send string resource you defined in the previous section.
Example
}
}
3 5
IT342: Mobile and Cloud Computing IT342: Mobile and Cloud Computing
The View class is the Android’s most basic component from which users
interfaces can be created. It acts as a container of displayable elements.
2 4
IT342: Mobile and Cloud Computing IT342: Mobile and Cloud Computing
Constraint layout is the default layout available in the Once your layout has created, you can load the layout resource
Android for building flexible and efficient layouts. All views from your application code, in your [Link]()
are laid out according to relationships between sibling views callback implementation.
and the parent layout.
7 9
IT342: Mobile and Cloud Computing IT342: Mobile and Cloud Computing
All the elements are displayed in linear fashion means all the Table Layout is used to arrange the group of views into rows
childs/elements of a linear layout are displayed according to its and columns. Table Layout containers do not display a border
orientation. line for their columns, rows or cells.
6 8
IT342: Mobile and Cloud Computing IT342: Mobile and Cloud Computing
Android considers XML-based layouts to be resources,
TextView displays text to the user and optionally allows them to edit
consequently layout files are stored in the res/layout directory inside
it programmatically.
your Android project.
11 13
IT342: Mobile and Cloud Computing IT342: Mobile and Cloud Computing
Set focus: To set focus on a specific view, you call the method.
10 12
IT342: Mobile and Cloud Computing IT342: Mobile and Cloud Computing
EditText is used to provide an input or text field, especially in forms.
A Button is a Push-button which can be pressed, or clicked, by the
user to perform an action.
It is a TextView with text editing operations.
15 17
IT342: Mobile and Cloud Computing IT342: Mobile and Cloud Computing
Example: set the text in a text view: Example: Set the text ”Username” in a edit text:
By XML:
By XML:
ﻧﻘﺪﺭ ﻧﻌﺪﻝ ﺑﺎﻝ ﺍﻛﺴﻤﻞ ﻭﺍﻟﺠﺎﻓﺎ
ﺑﺲ ﺍﻟﺠﺎﻓﺎ ﻳﻜﻮﻥ ﻣﻊ ﺍﻟﺮﻥ
ﻭﺍﻻﻛﺴﻤﻞ ﻗﺒﻞ ﺍﻟﺮﻥ
ﻭﺍﻟﺘﻐﻴﻴﺮ ﺍﻟﺜﺎﺑﺖ ﻳﻜﻮﻥ ﺍﻟﻠﻲ ﺑﺎﻟﺠﺎﻓﺎ
ﺍﻻﻛﺴﻤﻞ ﻛﺮﻳﻴﺖ ﺍﻻﻧﺘﺮﻓﻴﺲ
ﻭﺍﻟﺠﺎﻓﺎ ﻛﻮﻧﺘﺮﻭﻝ
By Java code:
By Java code:
14 16
IT342: Mobile and Cloud Computing IT342: Mobile and Cloud Computing
Display an image file in application.
CheckBox is a type of two state button either unchecked or checked
in Android.
Image file is easy to use but hard to master in Android, because of
the various screen sizes in Android devices.
Used when presenting a group of selectable options to users that are
not mutually exclusive
19 21
IT342: Mobile and Cloud Computing IT342: Mobile and Cloud Computing
Example: Set the size of the text on Button Example: Set the black color in the background:
By XML: By XML:
18 20
IT342: Mobile and Cloud Computing IT342: Mobile and Cloud Computing
RadioButton are mainly used together in a RadioGroup. GUI is event driven.
At one time we can check only one radio button from a group of
radio buttons which belong to same radio group.
Event source: button press, screen touch.
23 25
IT324: Modern Concepts of Applications Programming IT342: Mobile and Cloud Computing
Example: Set the size of text of a check box: Example: Set the size of the text of a radio button:
By XML: By XML:
22 24
IT342: Mobile and Cloud Computing IT342: Mobile and Cloud Computing
The View class defines several nested interfaces, each of which meant to
respond to a specific event:
Such interfaces are called event listeners
27 29
IT342: Mobile and Cloud Computing IT342: Mobile and Cloud Computing
Each view is responsible for handling those events resulting from the
interaction between the user and the View itself.
Example: The button when clicked
26 28
IT342: Mobile and Cloud Computing IT342: Mobile and Cloud Computing
Two steps are needed to handle events via event listeners:
Implementing the event listener interface
31 33
IT342: Mobile and Cloud Computing IT342: Mobile and Cloud Computing
You can assign a method to your button in the XML layout, using the
30 32
IT342: Mobile and Cloud Computing IT342: Mobile and Cloud Computing
Examples of event listeners:
34
IT342: Mobile and Cloud Computing