Unit-1 - 3BCA B.pptx
Document Details
Uploaded by GenerousChrysoprase6084
Tags
Full Transcript
BCA310: Mobile Applications MISSION VISION CORE VALUES CHRIST is a nurturing ground for an Excellence and Service Faith in God | Moral Uprightness individual’s holistic development to make...
BCA310: Mobile Applications MISSION VISION CORE VALUES CHRIST is a nurturing ground for an Excellence and Service Faith in God | Moral Uprightness individual’s holistic development to make Love of Fellow Beings effective contribution to the society in a Social Responsibility | Pursuit of CHRIST Deemed to be University Course Objectives Students will be able to build up an environment for developing: Android applications, construct user-friendly user interfaces, manage many tasks, develop persistent applications, handle cloud data, test their apps, and release them onto the market with the help of this course. Excellence and Service CHRIST Deemed to be University Course Learning Outcomes CO1: Demonstrate an understanding of enterprise level mobile applications with Kotlin on Android CO2: Apply the basic and advanced concepts of Mobile application development CO3: Design and develop user interfaces for the Android platforms CO4: Deploy the application on Google Play Excellence and Service CHRIST Deemed to be University Unit – I : Introduction (12 Hours) 1.1 History of Mobile Apps, 1.2 Trends in Market - Web App Vs Mobile App - Mobile OS. 1.3 Introduction to Android and Kotlin. 1.4 Kotlin: Kotlin Basics – variables - Functions. 1.5 First Android App 1.6 Setup Android Studio 1.7 Deploying the app: Running and Debugging app in Android Emulator. Lab Exercises: 1. Display Text and Image. 2. Implement Functions. Excellence and Service CHRIST Deemed to be University Brief Introduction of Mobile Technologies Mobile Technologies Wireless Communication Data Transmission Mobile technologies encompass a broad range of technologies and devices that facilitate wireless communication and data transmission. They are integral to modern life, enabling constant connectivity and access to information. Excellence and Service CHRIST Deemed to be University Key Components of Mobile Technologies Technology Specification Mobile Device Smartphones, Tablets and Wearables Mobile Networks 2G, 3G, 4G and 5G WiFi and Bluetooth Operating System Android, Linux and iOS. Mobile Applications Apps enhance the functionality of mobile devices, ranging from social media, gaming, and productivity tools to health monitoring and e- commerce platforms. Cloud Services Enable data storage, synchronization, and access across multiple devices, supporting services like iCloud, Google Drive, and Dropbox. Excellence and Service CHRIST Deemed to be University Advancements of Mobile Technologies 5G Networks Augmented Reality (AR) and Virtual Reality (VR) Artificial Intelligence (AI) and Machine Learning (ML) Internet of Things (IoT) Impact of Mobile Technologies Communication Business and Commerce Healthcare Education Mobile technologies continue to evolve, driving innovation and transforming various aspects of daily life, work, and society. Excellence and Service CHRIST Deemed to be University Different Mobile Technologies: Mobile technologies encompass a variety of hardware, software, and communication standards. Here’s a brief overview of different mobile technologies: 1. Cellular Networks 2. Wi –Fi 3. Bluetooth 4. NFC 5. GPS 6. Mobile OS 7. Mobile Application Development Platforms 8. Mobile Payment Technologies 9. AR and VR 10. Wearable Technology 11. IoT 12. Security Technologies Excellence and Service CHRIST Deemed to be University Introduction A mobile app, short for mobile application, is a software application designed to run on mobile devices such as smartphones, tablets, and smartwatches. These apps are typically developed and optimized for specific operating systems like iOS (Apple), Android (Google), or Windows Phone (Microsoft). Mobile apps can serve a wide range of purposes, from entertainment and social networking to productivity, shopping, education, and more. Excellence and Service CHRIST Deemed to be University 1.1 History of Mobile Apps In 1997, the Nokia 6110 included a built- in version of the basic arcade game “Snake,” which many consider the first mobile app. Excellence and Service CHRIST Deemed to be University 1999 – WAP was introduced; Blackberry OS was released and used for pagers. The first ‘app store’ Handango was launched. Web App concept introduced by Java. Excellence and Service CHRIST Deemed to be University ·In 2002, RIM launched the Blackberry 5810 with pre-loaded apps like ringtone editor, to-do list, sketch pad, arcade games, and also introduced wireless email. Excellence and Service CHRIST Deemed to be University Steve Jobs’ Apple launched the iPhone in 2007, which had several apps like photos, maps, weather, and more Excellence and Service CHRIST Deemed to be University In 2008 HTC released the first Android smartphone, the HTC Dream. The Dream was the first commercially released device to use the Linux-based Android operating system, which was purchased and further developed by Google Excellence and Service CHRIST Deemed to be University 1.3 Introduction to Android Open Handset Alliance (OHA): It's a consortium of 84 companies such as google, samsung, AKM, synaptics, KDDI, Garmin, Teleca, Ebay, Intel etc. It was established on 5th November, 2007, led by Google. It is committed to advance open standards, provide services and deploy handsets using the Android Platform. It is a Linux-based mobile operating system that Google developed. The initial version of Android was released on September 23, 2008, while the latest release was in February 2024. It is called Android “15 Vanilla Ice Cream”. It is developed by Google and later the OHA (Open Handset Alliance). Java language is mainly used to write the android code even though other languages can be used. The goal of android project is to create a successful real-world product that improves the mobile experience for end users. It brings new features like native satellite connectivity, high-quality webcam mode for PCs, and improved optimisation for foldable phones. Excellence and Service CHRIST Deemed to be University Excellence and Service CHRIST Deemed to be University Android Architecture Excellence and Service CHRIST Deemed to be University Android Key Features: Excellence and Service CHRIST Deemed to be University Android Applications: There are many android applications in the market. The top categories are: o Entertainment o Tools o Communication o Productivity o Personalization o Music and Audio o Social o Media and Video o Travel and Local etc. Excellence and Service CHRIST Deemed to be University Android Versions History When Google purchased it, it divided into two internal releases before it launched the beta version and the software development kit (SDK) in November 2007. Google released both the OS and SDK with their source code as free software under the Apache License. The company then publicly released Android 1.0 and 1.1, together with the launch of the T-Mobile G1 or HTC Dream in October 2008. The Future of Android OS Over the years, we have seen numerous updates from the Android operating system. Each has brought fresh capabilities and features that adapt to new technologies and human needs. Therefore, we can expect that the future of Android app development will be bright and hopeful. Excellence and Service CHRIST Deemed to be University Year of Release Android Version 2008-2009 1.0 Alpha to 1.1 Beta 2009 Version 1.5 Cupcake 2009 Version 1.6 Donut 2009 – 2010 Versions 2.0 to 2.1 Éclair 2010 Version 2.2 Froyo 2010 – 2011 Version 2.3 Gingerbread 2011 Version 3.0 to 3.2 Honeycomb 2011 Version 4.0 Ice Cream Sandwich 2012 – 2013 Versions 4.1 to 4.3 Jelly Bean 2013 – 2014 Version 4.4 Kitkat 2014 – 2015 Version 6.0 Lollipop 2015 – 2016 Version 6.0 Marshmallow 2016 Version 7.0 and 7.1 Nougat 2017 Version 8.0 and 8.1 Oreo 2018 Version 9 Pie 2019 Version 10 Quince Tart 2020 Version 11 Red Velvet Cake 2021 Version 12 and 12L Snow Cone 2022 Version 13 Tiramisu 2023 Version 14 Upside Down Cake 2024 Version 15 Vanilla Ice Cream Excellence and Service CHRIST Deemed to be University Discussion What is Android Android versions Features of Android Excellence and Service CHRIST Deemed to be University Get to know the required tools Developing Android applications requires a variety of tools and resources to efficiently write, test, and debug code. Here are the essential tools needed for Android development: Development Environment Description Features Android The official integrated development Code editing and debugging Studio environment (IDE) for Android development, Layout editor provided by Google. Emulator Code templates Performance profiling tools Java Required for developing Java-based Includes tools for Development Android applications. developing and testing Kit (JDK) Java programs. Excellence and Service CHRIST Deemed to be University Programming Languages Description Features Java Traditionally the primary language for Strongly typed, Android development, provided by Object-oriented programming language. Google. Code templates Performance profiling tools Kotlin Officially supported by Google for Modern, Android development since 2017. concise, and interoperable with Java. Build Tools Description Features Gradle Build automation tool used for Customizable build configurations managing project dependencies and Integration with Android Studio. build processes. Android SDK Essential tools for developing SDK tools (e.g., adb, fastboot) (Software Android applications. Platform tools Development Kit) System images for emulators API libraries Excellence and Service CHRIST Deemed to be University Testing Tools Description Features Allows testing of Android Simulation of different device configurations applications on a variety of virtual Support for various Android versions Android Emulator devices. A popular unit testing framework for Supports writing and running repeatable Java. tests. Junit Debugging and Profiling Description Features Command-line tool for communicating Install/uninstall apps, logcat, shell access. with a device. Android Debug Bridge (abd) Tool for viewing and filtering system Integrated tool in Android Studio for profiling CPU, log messages.. memory, and network usage. Logcat Excellence and Service CHRIST Deemed to be University 1.5 Creating first Android Application 1. Set Up Your Development Environment Install Android Studio Install the Java Development Kit (JDK) 2. Create a New Project Open Android Studio. Click on "Start a new Android Studio project." Select a project template. For a basic application, choose "Empty Activity" and click Next. Configure your project: o Name: MyFirstKotlinApp o Package name: com.example.myfirstkotlinapp o Save location: Choose a directory on your computer. o Language: Kotlin o Minimum API level: Select API 16: Android 4.1 (Jelly Bean). Click Finish to create the project. Excellence and Service CHRIST Deemed to be University 3. Understand the Project Structure kotlin: Contains the source code files written in Kotlin. res: Contains resources like layout files, images, and strings. AndroidManifest.xml: Describes essential information about your app, such as the package name, components, and permissions. 4. Design the User Interface 1. Open res/layout/activity_main.xml. This file defines the layout of your main activity. 2. Switch to Design view if you are in Text view. 3. Drag and drop a TextView from the palette to the design area. 4. Set the text of the TextView to "Hello, Jelly Bean!". 5. Write the Application Code 5.Open MainActivity.kt. 6.Modify the onCreate method to set the content view to the layout you just created. Excellence and Service CHRIST Deemed to be University 6. Run Your Application 1. Connect a Physical Device: o Enable Developer Options and USB Debugging on your Android device. o Connect your device to your computer via USB. 2. Use the Android Emulator: o Configure an emulator in Android Studio by going to Tools > AVD Manager and creating a new virtual device with API level 16. 3. Click the Run button (green arrow) in Android Studio. 4. Select your device or emulator from the list and click OK. Excellence and Service CHRIST Deemed to be University Development Process for Android Applications Excellence and Service CHRIST Deemed to be University 1.2 Trends in the Market: Web App v/s Mob App v/s Mob OS Aspect Web Apps Mobile Apps Development Cross-platform Platform-specific Platform (HTML5, CSS, JavaScript) (iOS, Android) Native experience on User Reach Accessible via browsers on any device smartphones/tablets Controlled updates, Updates Instant updates across all users subject to app store review Lower development costs Higher development costs due to Cost platform diversity Speed of Faster development cycles Slower development due to Development platform-specific coding Performance Generally slower than native apps Faster and more responsive due to native coding Better offline access with local Offline Capability Limited offline functionality storage Excellence and Service CHRIST Deemed to be University Different Mob OS Feature Android iOS Windows Mobile App Store Google Play Store, Apple App Store Microsoft Store third-party stores Varies with device Generally high performance Varies, generally lower Performance due to hardware-software specifications optimization performance Development Language Java, Kotlin Swift, Objective-C C#, Visual Basic, C++ Varies significantly between User Interface Consistent, polished UI Consistent but outdated manufacturers Security Generally secure but varies Highly secure, strict app Secure, but limited support by manufacturer review process and updates Customization Highly customizable Limited customization, Moderate customization controlled environment Device Variety Wide range of devices from Limited to Apple devices Limited device variety different manufacturers Excellence and Service CHRIST Deemed to be University 1.3 Introduction to Kotlin Kotlin is a programming language introduced by JetBrains in 2011, the official designer of the most intelligent Java IDE, named Intellij IDEA. This is a strongly statically typed general-purpose programming language that runs on JVM. In 2017, Google announced Kotlin is an official language for android development. Kotlin is an open source programming language that combines object-oriented programming and functional features into a unique platform. Excellence and Service CHRIST Deemed to be University Following are the great companies who are using Kotlin: 1. Google 2. Amazon 3. Netflix 4. Pinterest 5. Uber 6. Trello 7. Coursera 8. Basecamp 9. JetBrains Kotlin Online Compiler Excellence and Service CHRIST Deemed to be University Why Kotlin? Kotlin works on different platforms (Windows, Mac, Linux, Raspberry Pi, etc.) and it's 100% compatible with Java. Kotlin is getting high popularity among all level of programmers and it is used for: 1. Cross-platform Mobile applications. 2. Android Application Development. 3. Web Application Development 4. Server Side Applications 5. Desktop Application Development 6. Data science based applications Excellence and Service CHRIST Deemed to be University Kotlin Architecture Kotlin is a programming language and has its own architecture to allocate memory and produce a quality output to the end user. Kotlin compiler will work differently: 1. Compile Kotlin into bytecode which can run on JVM. This bytecode is exactly equal to the byte code generated by the Java.class file. 2. Whenever Kotlin targets JavaScript, the Kotlin compiler converts the.kt file into ES5.1 and generates a compatible code for JavaScript. 3. Kotlin compiler is capable of creating platform basis compatible codes via LLVM (Low Level VM). 4. Kotlin Multiplatform Mobile (KMM) is used to create multiplatform mobile applications with code shared between Android and iOS. Excellence and Service CHRIST Deemed to be University Whenever two-byte coded files ( Two different programs from Kotlin and Java) runs on the JVM, they can communicate with each other, and this is how an interoperable feature is established in Kotlin for Java. Excellence and Service CHRIST Deemed to be University Kotlin Basic Syntax An entry point of a Kotlin application is the main() function. A function can be defined as a block of code designed to perform a particular task. print() vs println() The print() is a function in Kotlin which prints its argument to the standard output, similar way the println() is another function which prints its argument on the standard output, but it also adds a line break in the output. Both the functions (print() and println()) can be used to print numbers as well as strings and at the same time to perform any mathematical calculations Excellence and Service CHRIST Deemed to be University Semicolon in Kotlin Kotlin code statements do not require a semicolon (;) to end the statement like many other programming languages, such as Java, C+ +, C#, etc. do need it. Comments in Kotlin Just like most modern languages, Kotlin supports single-line (or end- of-line) and multi-line (block) comments. 1. Single Line 2. Multi Line 3. Nested Excellence and Service CHRIST Deemed to be University Kotlin Keywords Kotlin keywords are predefined, reserved words used in Kotlin programming that have special meanings to the compiler. Kotlin uses fun keyword to define a function. Kotlin Keywords are divided into three types: 1. Hard Keywords 2. Soft Keywords and 3. Modifier Keywords. Excellence and Service CHRIST Deemed to be University (1) Kotlin Hard Keywords Following is a list of hard keywords and they cannot be used as identifiers: as as? break class continue do else false for fun if in !in interface is !is null object package return super this throw true try typealias typeof val var when while Excellence and Service CHRIST Deemed to be University (2) Kotlin Soft Keywords Following is the list of keywords (soft) in the context when they are applicable and can be used as identifiers in other contexts: by catch constructor delegate dynamic field file finally get import init param property receiver set setparam value where Excellence and Service CHRIST Deemed to be University (3) Kotlin Modifier Keywords Following is the list of tokens which act as keywords in modifier lists of declarations and can be used as identifiers in other contexts: actual abstract annotation companion const crossinline data enum expect external final infix inline inner internal lateinit noinline open operator out override private protected public reified sealed suspend tailrec vararg Excellence and Service CHRIST Deemed to be University Kotlin Variables Variables are an important part of any programming. They are the names you give to computer memory locations which are used to store values in a computer program and later you use those names to retrieve the stored values and use them in your program. Kotlin variables are created using either var or val keywords and then an equal sign = is used to assign a value to those created variables. Example: var name = “Manasa” Excellence and Service CHRIST Deemed to be University Kotlin variables rules: Kotlin variable names can contain letters, digits, underscores, and dollar signs. Kotlin variable names should start with a letter or underscores. Kotlin variables are case sensitive which means Zara and ZARA are two different variables. Kotlin variable cannot have any white space or other control characters. Kotlin variable cannot have names like var, val, String, Int because they are reserved keywords in Kotlin. Excellence and Service CHRIST Deemed to be University Kotlin Data Types Kotlin data type is a classification of data which tells the compiler how the programmer intends to use the data. Kotlin is a statically typed language, which means that the data type of every expression should be known at compile time. Kotlin built in data type can be categorized as follows: 1. Number 2. Character 3. String 4. Boolean 5. Array Excellence and Service CHRIST Deemed to be University (a) Kotlin Number Data Types Kotlin number data types are used to define variables which hold numeric values, and they are divided into two groups: (a) Integer types store whole numbers, positive or negative (b)Floating point types represent numbers with a fractional part, containing one or more decimals. Data Type Size (bits) Byte 8 bit Short 16 bit Int 32 bit Long 64 bit Float 32 bit Double 64 bit Excellence and Service CHRIST Deemed to be University (b) Kotlin Character Data Type Kotlin character data type is used to store a single character and they are represented by the type Char keyword. A Char value must be surrounded by single quotes, like 'A' or ‘1’. Kotlin supports a number of escape sequences of characters. When a character is preceded by a backslash (\), it is called an escape sequence and it has a special meaning to the compiler. For example, \n in the following statement is a valid character and it is called a new line character. The following escape sequences are supported in Kotlin: \t, \b, \n, \ r, \', \", \\ and \$. Excellence and Service CHRIST Deemed to be University (c) Kotlin String Data Type The String data type is used to store a sequence of characters. String values must be surrounded by double quotes (" ") or triple quote (""" """). We have two kinds of string available in Kotlin - one is called Escaped String and another is called Raw String. Escaped string is declared within double quote (" ") and may contain escape characters like '\n', '\t', '\b' etc. Raw string is declared within triple quote (""" """) and may contain multiple lines of text without any escape characters. Excellence and Service CHRIST Deemed to be University (d) Kotlin Boolean Data Type Boolean is very simple like other programming languages. We have only two values for Boolean data type - either true or false. (e) Kotlin Array Data Type Kotlin arrays are a collection of homogeneous data. Arrays are used to store multiple values in a single variable, instead of declaring separate variables for each value. Excellence and Service