MP Lecture1 Presentation
MP Lecture1 Presentation
MOBILE PROGRAMMING
ASST. LECT. GHASAQ B. ABDULHUSSEIN
[email protected]
3RD Stage
OUTLINE
Mobile Device
Mobile Operating System and Mobile OS Types
Mobile Application
Android Emulator
Android Versions
Android Features
Apps and Packages
INTRODUCTION
The Mobile application development is the set of processes and procedures involved
in writing software for small, wireless computing devices, such as smartphones and
other hand-held devices.
Mobile application development is similar to Web application development and has its
roots in more traditional software development.
One critical difference, however, is that mobile applications (apps) are often written
specifically to take advantage of the unique features a particular mobile device offers.
One way to ensure that applications show optimum performance on a given device is
to develop the application (app) natively on that device.
MOBILE DEVICE
The mobile device consists of not only smartphones but also other handheld
computers, such as a tablet.
A mobile device has a mobile operating system and can run various types of apps.
The most important parts of a mobile device are Central Processing Unit (CPU),
memory, and storage. (RAM & ROM)
Most mobile devices can also be equipped with Wi-Fi, Bluetooth, and Global
Positioning System (GPS) capabilities, and they can connect to the Internet, other
Bluetooth-capable device and the satellite navigation system.
Meanwhile, a mobile device can be equipped with some human - computer
interaction capabilities, such as camera, microphone, audio systems, speech
recognition, voice recorder, and some sensors.
MOBILE OPERATING SYSTEM
The mobile operating system is a set of data and programs that runs on a mobile
device.
Every mobile communication device needs some type of mobile operating system to
run its services: voice calls, short message service, camera functionality, and so on.
It manages the hardware and makes it possible for smartphones, tablets, and
wearables to run apps.
A mobile OS typically starts up when a device powers on, presenting a screen with
icons or tiles that present information and provide application access.
Mobile operating systems also manage cellular and wireless network connectivity, as
well as phone access.
MOBILE OPERATING SYSTEM (CONT…)
All kinds of mobile devices run on various Operating
Developer
Release
Status Primary Devices
System Year
mobile Operating Systems (OS), also
Samsung, Google Pixel,
referred to mobile OSs, such as: Android Google 2008 Active
Xiaomi, etc.
iOS Apple 2007 Active iPhone, iPad
The operating systems for mobile devices, Huawei smartphones,
HarmonyOS Huawei 2019 Active
which are among the most common tablets
consumer devices, provide the different KaiOS KaiOS Technologies 2017 Active
Feature phones (e.g.,
JioPhone), Nokia 8110 4G
interfaces of communication between the
Lumia((Nokia/Microsoft)),
software components at the application Windows Mobile Microsoft 2010 Discontinued (2019)
HTC
layer and hardware devices, while their BlackBerry OS BlackBerry Limited 1999 Discontinued (2013) BlackBerry smartphones
application development platforms provide
Samsung Galaxy Watch, Z-
building, test and deploying mobile Tizen Linux Foundation 2012 Active
series
applications. Today, these devices provide Ubuntu Touch UBports 2013 Active (Specialized) Fairphone, PinePhone
us with huge number of services, such: Sailfish OS Jolla 2013 Active (Specialized) Jolla smartphones
Symbian Nokia 1998 Discontinued (2013) Nokia smartphones
voice calls, messaging, camera, internet Palm OS Palm, Inc. 1996 Discontinued (2009) Palm devices
browsers, music and video players, games
Firefox OS Mozilla 2013 Discontinued (2016) Low-cost smartphones
and many others.
MOBILE OPERATING SYSTEM TYPES
The operating system on a mobile phone is the very basic software which allows your
phone to operate.
The operating system provides all of the basic functionality of the phone.
Each mobile phone needs to include some kind of mobile operating system in order
to execute these services. Actually, they are based on various platforms and operating
systems to satisfy different user segments. It resulted in growing number of mobile
operating systems and application development platforms.
Mobile operating systems manage the mobile devices’ hardware and software, similar
to computer operating systems.
Some mobile operating systems are popular because of their uniqueness, while the
others are wanted because they are freely available or the best at features and quality.
MOBILE OS TYPES (CONT…)
Windows
Windows Phone is a proprietary smartphone operating
system developed by Microsoft.
It is first released in 2010 under the name Windows Phone 7.
Various hardware manufacturers including HTC, Samsung, LG,
and Nokia are developing Windows Phone devices.
Unique GUI- called as tiles-based user interface.
Provides the best support to view, edit and create office
documents.
The Windows Phone kernel handles low-level device driver
access as well as basic security, networking, and storage.
BLACKBERRY OS
Many companies that have taken advantage of Android’s open source policy include
Motorola and Sony Ericsson, which have been developing their own mobile
operating systems for many years.
Moreover, hardware manufacturers (vendors) will continue to design their own
hardware and use Android as the operating system that powers it.
The main advantage to adopt Android is that it offers a unified approach to
application development. Developers need only develop for Android in general, and
their applications should be able to run on numerous different devices, as long as
the devices are powered using Android.
In the world of smartphones, applications are the most important part of the
success chain.
ANDROID OS SECURE FEATURES:
Android OS has several secure features that provide a secure environment for users' devices, data, applications, and network.
These features include:
1. Security at OS levels through Linux Kernel: Android uses the Linux kernel, which provides a secure base for mobile
computing and provides features such as permissions model, process isolation. The Linux kernel also has built-in security
measures, such as user-based permission model, secure mechanism for IPC (inter process communication), process
isolation, and ability to clear any unnecessary insecure parts of the kernel.
2. Application Sandboxing: Each Android application is run as a separate process, with its own user ID (UID) and
permissions, which prevents one application from accessing another application's resources. This is done by setting up a
kernel-level application sandbox.
3. Inter-process communication security: Android performs each app at the process level through the Linux kernel,
which does not permit apps to interact with the other apps and assigns them only some limited accesses to the Android
OS.
4. Application signing: Application signing provides a list of permissions on the first page of installation package (APK)
that the intended app will utilize (or access) them after running on the device. This feature gives a set of file system
permissions so that each app has its own files and except a developer explicitly exhibits files to another Android app, files
generated by one app cannot be read or changed by another one.
5. User application permissions: Android provides a permission-granting mechanism that enforces restrictions on the
specific operations that a particular application can perform.
6. Dynamic permission granting mechanism: They are divided into "normal" and "dangerous", and each dangerous
permission belongs to a specific permission group. When a dangerous permission is requested, the application is
required to pop up a dialog box describing the related permission group to ask for granting consent.
7. Forbidding HTTP protocol: Applications running on Android P are required to use HTTPS protocol for encrypted
connections, and HTTP protocol is prohibited by default. If HTTP is truly needed in an application, the developer should
make a specific declaration in the manifest file.
8. Storage sandbox: The latest system uses new storage permission mechanism without "READ EXTERNAL STORAGE"
and "WRITE EXTERNAL STORAGE", and create storage sandbox for each application. With the sandbox, an application
could access its own files on external storage without any permissions, and prevent unauthorized accesses from other
applications.
9. Protection of unique device identifier: Leak of unique device identifier, such as device id (IMEI), serial number and
MAC address, is a long-standing problem. In Android P, Google rolled out a developer option to enable MAC address
randomization, but it was turned off by default. With Android Q, the address will stay random even after you connect to
a network, thus hiding your unique MAC.
These secure features provide a robust security framework for Android OS, addressing various security threats such as
malware, unauthorized access, and data breaches. Additionally, Android's open-source nature allows for community-driven
security solutions, with many security companies porting their solutions to Android-based devices. Furthermore, Google has
implemented its own security mechanisms, such as Bouncer, to enhance application security. Overall, Android's secure
features and mechanisms make it a secure and reliable platform for users.
BASE ANDROID FEATURES
Because Android is open source and freely available to manufacturers for customization, there are no fixed hardware or
software configurations. However, the base Android OS supports many features, including
Storage—SQLite, a lightweight relational database, for data storage.
Connectivity—GSM/EDGE, IDEN, CDMA, EV-DO, UMTS, Bluetooth, Wi-Fi, LTE, and WiMAX.
Messaging—Both SMS and MMS.
Graphics and Media: Android OS supports 2D and 3D graphics through the SGL and Open GL/ES libraries, respectively.
Media support H.263 (in 3GP or MP4 container), MPEG-4 SP(in 3GP container), AAC (in MP4 or 3GP container), MP3,
MIDI, Ogg Vorbis, WAV, JPEG, PNG, GIF, and BMP.
Hardware support—Accelerometer sensor, camera, digital compass, proximity sensor, and GPS.
Multi-touch—Multi-touch screens. And Multi-tasking—Multi-tasking applications.
Tethering—Sharing of Internet connections as a wired/wireless hotspot.
eSIM Support: Android OS has supported eSIM technology since Android 9, allowing for multiple profiles and LPA (Local
Profile Agent) support.
MOBILE APPLICATION
Application software designed and developed to run on mobile device such as Smart phones
or Tablets are called as an app. This process is also called as Mobile Application Development
which is similar to the Web Application Development process whose roots are in the
process of traditional software development.
Mobile applications provides all required services as like of the application software’s
developed for PC’s such as online shopping, performing online banking applications, etc.
There is slight difference between the application software’s and the apps are the small
software programs which are developed to meet the intended specific requirement of the
users.
These apps are also called as smart phone apps or Android apps or iphone apps since these
are developed to take advantages of unique features of particular mobile such as Android
Mobiles, iphone mobiles or Microsoft Mobiles.
Furthermore, smartphones are designed to allow external developers to write software for
these devices.
ANDROID EMULATOR
The Android emulator is an Android Virtual Device (AVD), which represents a specific Android
device. We can use the Android emulator as a target device to execute and test our Android
application on our PC.
The Android emulator provides almost all the functionality of a real device. We can get the
incoming phone calls and text messages. It also gives the location of the device and simulates
different network speeds. Android emulator simulates rotation and other hardware sensors. It
accesses the Google Play store, and much more.
Testing Android applications on emulator are sometimes faster and easier than doing on a real
device. For example, we can transfer data faster to the emulator than to a real device connected
through USB.
The Android emulator comes with predefined configurations for several Android phones, Wear
OS, tablet, Android TV devices.
The emulator behaves like a piece of Android hardware, but it is a program you run on your
development machine.You can use this emulator to emulate many different devices, with different
screen sizes and Android OS versions, by creating one or more Android virtual devices, or AVDs.
ANDROID VERSIONS
The development of the Android operating system was started in 2003 by Android, Inc.
Later on, it was purchased by Google in 2005.
The beta version of Android OS was released on November 5, 2007, while the
software development kit (SDK) was released on November 12, 2007.
The latest Android version is Android 16 (API level 36) which introduces a great new
features and APIs for developers.
LIST OF ANDROID VERSIONS
APPS AND PACKAGES
The application comes in the form of an APK file. It is that APK file that you will upload to the Play Store or
distribute by other means.
Each Android application has a package name, also referred to as an application ID. A package name must fulfill
three requirements:
1. It must be a valid Java package name, as some Java source code will be generated by the Android build tools in
this package
2. No two applications can exist on a device at the same time with the same application ID
3. No two applications can be uploaded to the Play Store having the same application ID
When you create your Android project — the repository of that source code and those resources — you will
declare what package name is to be used for your app. Typically, you will pick a package name following the Java
package name “reverse domain name” convention (e.g., com.example.first_lab). That way, the domain name system
ensures that your package name prefix (com.example) is unique, and it is up to you to ensure that the rest of the
package name distinguishes one of your apps from any other
ANDROID STUDIO
In the Component Tree, notice that the root of the view hierarchy is a
ConstraintLayout view.
Every layout must have a root view that contains all the other views. The
root view is always a view group, which is a view that contains other views. A
ConstraintLayout is one example of a view group. (Notice that the
ConstraintLayout contains a TextView.)
In order to change property values, in the code editor, examine the
properties in the TextView element.
Instead of changing the text value every time by clicking on the item and
going to the text as shown in the figure or going to the XML code and
changing the text,You can go to app> res values string.xml file and add
new string to use it later on or to change in one file instead of many file if
you have the same string in number of activities.
In the same way of adding string, you can add colors.
2
Other way to add string: 3
4
PRACTICAL
(setContentView (R.layout.activity_main)) It is used to link your design to your code.
In order to use anything in the design, you need to put an “id” to it and then call it using
the (findViewById(R.id.yourUI_id)). You will see it later in this Lecture.
LET'S ANALYZE THE DEFAULT MAINACTIVITY.JAVA CODE:
The first line is the package definition as in usual Java code. It shows to which package this file belongs to.
The next two lines are import lines which import the required libraries. In our file, the AppCompatActivity and Bundle
libraries are imported. They contain the base methods for user interaction and passing data among different activities.
The next line declares the MainActivity class which extends the AppCompatActivity class. This is like the class definition
in Java. As in Java, the class name in Android should match the name of the .java file. In this case, the file is
MainActivity.java therefore the name of the class is MainActivity.
Then an @override command is placed by default. It is used to tell the compiler that the current class will override any
existing superclasses.
The sixth code line defines a method called onCreate(). All activities are started by a sequence of method calls.
onCreate() method is the first of these calls.
The next line, super.onCreate(savedInstanceState);, tells that our code will be executed in addition to the existing code
(if any) of the parent class.
In the last line, setContentView() method sets the activity content from a layout source. We have set up our app‟s layout
in the file activity_main.xml. Android accesses all resources via an auxiliary class called “R”. The R class is a special class
which enables Android to utilize the resources in a simpler way compared to accessing via file paths. The argument of
the setContentView() method is R.layout.activity_main which means “set the content of the activity to be the layout
residing in activity_main.xml”
This block of code is responsible for enabling edge-to-edge display in your Android app and handling system
window insets (e.g., status bar, navigation bar) to ensure your app's content is properly laid out and doesn't
overlap with system UI elements.
Used to handle edge-to-edge display (ensuring the app uses the full screen, including areas behind system bars
like the status bar or navigation bar).
Why Is This Necessary?
When you enable edge-to-edge display: Your app's content can extend behind the system bars (status bar and navigation
bar). However, if you don't handle the insets, your content might overlap with the system bars, making it unreadable or
inaccessible. By setting padding based on the system bar insets, you ensure your content is properly laid out and visible.
Difference with and without edge-to-edge:
Without edge-to-edge, the app content is constrained between the status bar and navigation bar.
With edge-to-edge, the app content extends behind the system bars, but padding is added to ensure the content doesn't overlap.
EdgeToEdge.enable(this) enables edge-to-edge display.
setContentView(R.layout.activity_main) sets the layout for the activity.
ViewCompat.setOnApplyWindowInsetsListener ensures the app's content doesn't overlap with system bars by adding
padding based on the system bar insets.
WE HAVE LEARNED TODAY:
Mobile Application
Android Emulator
Android Versions
Android Features