1st Unit Android

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 40

Unit=1

What is Android?

Android is an open source and Linux-based Operating System for mobile devices such
as smartphones and tablet computers. Android was developed by the Open Handset
Alliance, led by Google, and other companies.
Android offers a unified approach to application development for mobile devices which
means developers need only develop for Android, and their applications should be able
to run on different devices powered by Android.
The first beta version of the Android Software Development Kit (SDK) was released by
Google in 2007 where as the first commercial version, Android 1.0, was released in
September 2008.

Why Android ?
Features of Android
Android is a powerful operating system competing with Apple 4GS and supports great
features. Few of them are listed below −

Sr.No. Feature & Description

1 Beautiful UI
Android OS basic screen provides a beautiful and intuitive user interface.

2 Connectivity
GSM/EDGE, IDEN, CDMA, EV-DO, UMTS, Bluetooth, Wi-Fi, LTE, NFC
and WiMAX.

3 Storage
SQLite, a lightweight relational database, is used for data storage
purposes.
4 Media support
H.263, H.264, MPEG-4 SP, AMR, AMR-WB, AAC, HE-AAC, AAC 5.1,
MP3, MIDI, Ogg Vorbis, WAV, JPEG, PNG, GIF, and BMP.

5 Messaging
SMS and MMS

6 Web browser
Based on the open-source WebKit layout engine, coupled with Chrome's
V8 JavaScript engine supporting HTML5 and CSS3.

7 Multi-touch
Android has native support for multi-touch which was initially made
available in handsets such as the HTC Hero.

8 Multi-tasking
User can jump from one task to another and same time various application
can run simultaneously.

9 Resizable widgets
Widgets are resizable, so users can expand them to show more content or
shrink them to save space.

10 Multi-Language
Supports single direction and bi-directional text.

11 GCM
Google Cloud Messaging (GCM) is a service that lets developers send
short message data to their users on Android devices, without needing a
proprietary sync solution.

12 Wi-Fi Direct
A technology that lets apps discover and pair directly, over a high-
bandwidth peer-to-peer connection.

13 Android Beam
A popular NFC-based technology that lets users instantly share, just by
touching two NFC-enabled phones together.

Android Applications
Android applications are usually developed in the Java language using the Android
Software Development Kit.
Once developed, Android applications can be packaged easily and sold out either
through a store such as Google Play, SlideME, Opera Mobile Store, Mobango, F-
droid and the Amazon Appstore.
Android powers hundreds of millions of mobile devices in more than 190 countries
around the world. It's the largest installed base of any mobile platform and growing fast.
Every day more than 1 million new Android devices are activated wor ldwide.

Categories of Android applications


There are many android applications in the market. The top categories are −

History of Android
The code names of android ranges from A to N currently, such as Aestro, Blender,
Cupcake, Donut, Eclair, Froyo, Gingerbread, Honeycomb, Ice Cream Sandwitch, Jelly
Bean, KitKat, Lollipop and Marshmallow. Let's understand the android history in a
sequence.
Advantages of Android App Development:

Low investment and high Returns:

Android compared to other mobile platforms has a low barrier for entry. It
provides Software Development Kit (SDK) to the development community for
free, which in turn reduces the development and licensing costs.

Easy Integration:

Android is said to be the best mobile platform between the application and
processes architecture. The entire Android platform is ready for customization.
The developers can tweak and integrate the mobile app according to ones
business requirement.

Open Source:

The architecture of its SDK being open source it allows the developers to
communicate with the Android community about any upcoming expansion of
android mobile application development. This is what makes the platform so
attractive for handset manufacturers and wireless operators, resulting in fast
development of Android based apps.

Multiple Sales Channels:

Android application can be deployed in various ways, unlike other mobile


platforms. The developer does not have to rely on a single market place to
distribute the apps, they can also use third-party application marketplace and
form their own distribution and sales channel. The added advantage of this
platform is the developer can build it, publish it and distribute it anywhere they
want with their choice of marketing strategy.

Easy Adoption:

Android applications are built on java with the help of its robust set of features.
Anyone with Java knowledge can build applications in Android. The Java
developers find it easy and beneficial creating Android applications.

Android is Google’s new Linux based smartphone platform, including software


stack for Mobile devices and tablets. It uses Java language which makes it
possible to develop third-party applications on Java.

Must have mobile app features/characterestics


include:

1. Simplicity

Many people have short attention spans and if you make your app difficult to
navigate then they will lose interest fast. If your customer cannot access their
information quickly and easily, they will become frustrated and do it another
way – possibly by using a competitor’s app

2. Speed

Fast loading screens are vital. No one likes waiting, particularly when all they
have to look at is a screen-loading symbol and this frustration soon gives way
to boredom resulting in a decision to seek something better. 3. Good image
resolution

While you have to balance app speed against functionality and resolution, you
have to ensure that what you have on screen is sufficiently detailed to make
the user experience worthwhile

4. Flexibility

There are three main mobile operating systems – iOS, Android, and Windows
– and in order to achieve the best out of your app, it needs to be available on
all of these. Android apps are easy to upload to the PlayStore, but iOS needs
to be tried and tested by Apple before they are allowed on the App Store.

5. Security

Internet security is becoming an ever-increasing issue and the same applies


for your app. With many applications storing personal and sensitive
information or credit and debit card details, security is an absolute must.

6. Search options

It sounds simple but many apps miss this important feature considering this is
something that many users make use of. The ability to search either the app
or the internet is important and while it’s not going to work so much for game-
based apps, it’s essential for the business and social variety.

7. Bright and bold colour schemes

Fundamentals such as eye-grabbing colour schemes are going to pull your


customers in

8. Push notifications

Easier to send than emails and less likely to end up in a spam folder, push
notifications can be text, graphic, or a combination of both to send your users
content that they may be interested in

9. User feedback

While you would want to make the perfect app the first time around, there are
always going to be other ways to make it better and suit the user more. The
best way to understand that is to ask the user themselves.
10. Updates

Once you have your feedback, you can sort out how to make your app more
relevant to your customers, and send out updates periodically.

Infrastructure as a service in mobile application

There are many more items which you use to build a good Android application. Apart
from coding for the application, you take care of various other resources like static
content that your code uses, such as bitmaps, colors, layout definitions, user interface
strings, animation instructions, and more. These resources are always maintained
separately in various sub-directories under res/ directory of the project.
This tutorial will explain you how you can organize your application resources, specify
alternative resources and access them in your applications.

Organize resource in Android Studio


MyProject/
app/
manifest/
AndroidManifest.xml
java/
MyActivity.java
res/
drawable/
icon.png
layout/
activity_main.xml
info.xml
values/
strings.xml

Sr.No. Directory & Resource T ype

1 anim/
XML files that define property animations. They are saved in res/anim/
folder and accessed from the R.anim class.

2 color/
XML files that define a state list of colors. They are saved in res/color/ and
accessed from the R.color class.

3 drawable/
Image files like .png, .jpg, .gif or XML files that are compiled into bitmaps,
state lists, shapes, animation drawable. They are saved in res/drawable/
and accessed from the R.drawable class.

4 layout/
XML files that define a user interface layout. They are saved in res/layout /
and accessed from the R.layout class.
5 menu/
XML files that define application menus, such as an Options Menu, Context
Menu, or Sub Menu. They are saved in res/menu/ and accessed from
the R.menu class.

6 raw/
Arbitrary files to save in their raw form. You need to
call Resources.openRawResource() with the resource ID, which
is R.raw.filename to open such raw files.

7 values/
XML files that contain simple values, such as strings, integers, and colors.
For example, here are some filename conventions for resources you can
create in this directory −
 arrays.xml for resource arrays, and accessed from the R.array class.
 integers.xml for resource integers, and accessed from
the R.integer class.
 bools.xml for resource boolean, and accessed from the R.bool class.
 colors.xml for color values, and accessed from the R.color class.
 dimens.xml for dimension values, and accessed from
the R.dimen class.
 strings.xml for string values, and accessed from the R.string class.
 styles.xml for styles, and accessed from the R.style class.

8 xml/
Arbitrary XML files that can be read at runtime by
calling Resources.getXML(). You can save various configuration files here
which will be used at run time.

What does a Mobile Engineer do?


Mobile engineers design, develop, and im plement software programs for smartphones and
other m obile devices. They often specialize in a certain type of operating system, such as
Android or iOS. They use data-driven insights to guide developm ent of programs and apps
that fill a user need. They create specifications and detailed plans, write code, oversee
testing and debugging, and play an active role in the rollout and launch. They commonly
work in close collaboration with other engineers, designers, R&D, ana lysts, and other teams
and stakeholders.
What responsibilities are common for Mobile Engineer jobs?
 Elevate code into the developm ent, test, and production environm ents on schedule.

 Participate in code reviews and weekly iOS team remote meetups.

 Technical mentorship of junior developers and cross functional supporting roles.

 Perform regular performance evaluations and share and seek feedback.

 Manage the design and architecture of modules in the overall product.

 Direct internal and external resources in software developm ent to deliver assigned
modules.

 Assist with troubleshooting production problems, root cause analysis, and


debugging.

 Work closely with the product, design and engineering teams.

 Actively engage in development activities associated with develop new solutions and
refining current solutions.

 Provide general technical support and training to fellow colleagues and clients.

 Perform detailed technical design and im plementation of complex iOS applications.

 Collaborate and meet with the team to review status, identify potential blockers.

 Communicate frequently with clients including project plans and scope.

 Willingness to mentor and advise other team mem bers

 Debug and solve complex issues by translating business problems into technical
solutions.

 Lead requirements gather meetings and reviews designs with the business.

 Stay up to date with new Growth and Personalization tools.

 Diagnose com plex issues, evaluate, recommend and execute the best resolution.

 Assume a lead role on an agile team responsible for iOS solutions.

 Maintain constant communication within IT and other business units.

 Contribute to build top quality engineering teams and technology practices .

What are the typical qualifications for Mobile Engineer jobs?


 Bachelor's or Graduate's Degree in computer engineering, computer science,
electrical engineering or engineering.

 Experience with applicable software and programs including C, UI Design, JAVA,


and ReAct.

 Experience with Android Software Development and Android Studio.

 Fluency in interfacing and unit testing.

 A natural problem solver and critical thinker.

 Is comfortable debugging and working with object oriented programming .

Mobile App Framework?


A mobile app framework is a software creation platform that includes tools and
software, compilers, debugging tools, and programming interfaces, among
other things. Thus, a developer creates the application’s source code and the
framework and uses various elements to generate the application for the
different mobile devices.

Best Mobile App Development Frameworks in 2022


Modern-day mobile app development frameworks provide several built-in
benefits, like speed, effectiveness, and a bug-free atmosphere. The
framework uses pre-built elements, including compilers, debugging tools, and
toolkit, to display the application on the target device using the company’s
code.

Types of Mobile App Frameworks


Android, iOS, as well as Windows are just a few of the digital devices
available. Mobile applications come in a variety of shapes and diverse sizes.
We’re not speaking about specific app areas like purchasing or games.
However, in terms of how applications work on a smartphone, mobile apps
may be divided into three categories.

1. Native Apps
They are designed for specific operating systems such as Android, iOS,
and Windows. Apps make use of device features such as RAM,
camera, GPS, and so on.
2. Web Apps
A Web app is software that is kept in a distant location and distributed
via the Web using a browser interface. Emails, online shopping sales,
auction sites, weblogs, instant messaging apps, and other web apps are
popular.
3. Hybrid Apps
Hybrid apps are applications that are launched on a smartphone in the
same way that every other application is. What sets them apart is that
hybrids combine features from native apps and with components from
web apps.

The mentioned frameworks are commonly used to create these apps.

 Native app framework


 Hybrid app framework

Top Mobile App Development Frameworks


in 2022
React Native,= built and supported by Facebook, is an accessible,
cross-platform application development framework that has quickly become
the preferred option of programmers. React Native facilitates the development
of Android and iOS mobile applications. The most exemplary instances of
React Native apps are those from prominent businesses like Tesla, Airbnb,
Skype, or Amazon Prime.
React Native is on the list of the best mobile app development frameworks. It
allows for building platform-specific versions of multiple features enabling
easy use of a single codebase across all platforms.

The React Native design has a similar syntax to CSS, as it does not utilize
HTML or CSS. The messages from the JavaScript thread are used to exploit
native views.

1. Features of React Native –


 Exceptional performance
 Components that can be reused
 Compatibility with third-party extensions
2. Flutter
Flutter is an open and free framework from Google that allows you to
create native Android and iOS applications with a simple codebase.
It’s a ground-breaking SDK for cross-platform application development,
which distinguishes it because it takes a novel way of creating native-
like apps. It’s an unrivaled and dependable smartphone UI framework
for swiftly developing attractive apps by accelerating development.

1. Features of Flutter –
 More rapid development.
 Cross-platform.
 Visuals that are both appealing and engaging.
 Performance that is pretty similar to that of a native
2. Xamarin
Xamarin is an alternative cross-platform application development
framework for developing applications for Android and iOS. Because
they employ the C# programming language, the applications need fewer
lines of code. As a result, the process of coding is quicker. Also, it
allows us to rapidly transfer the scripts across other systems, such as
Windows and macOS.

Microsoft has acquired Xamarin. Because developing an app is so


much faster these days, you might assume that quicker development
means sacrificing quality and construction. However, Xamarin-based
apps deliver flawless native functionality about quality and efficiency.

Features of Xamarin –

 Rapid Advancement
 Appearance and touch of a native app
 Compatibility with a variety of devices

3.Swiftic
Swiftic is a do-it-yourself mobile app platform that seeks to make it easy for
anybody to build unique applications for their company. It simplifies app
development by allowing programmers to integrate current material from the
internet rather than starting fresh

4.IonicThe framework aids developers in creating solid and feature-rich native


apps. The most prominent feature of Ionic would be that it lets programmers
employ various UI components in the application framework, including
filtration, inputs, views, easy navigation, and actions sheets.

Features of Ionic –
 App development for many platforms.
 The user interface is consistent.
 Enhanced performance.
 The flexibility of the user

Native Scripts
Native Script is a precise open-source framework to build up native mobile
applications entrusted with Angular, Typescript, JavaScript, CSS, and Vue.js.
It was designed and developed by Progress.

Platform-independent user interfaces are defined with the use of XML files.
Then NativeScript operates the inferences represented in the XML files to call
the native UI components of each platform.

Features of jQuery –

 Native user interface without Web Views


 Full and direct access to Android & iOS APIs
 Cross-platform application

6.Sencha Ext =JS is a cross-platform mobile development structure.


Formerly known as Sencha, it was combined with Ext JS and is known as
Sencha Ext JS. It was developed as an add-on library attachment of YUI by
Jack Slocum. You can use this JavaScript framework for creating data-
intensive applications for the web and mobiles.

Features of Sencha Ext JS:

 Millions of data can be managed


 Robust data analytics
 Adjustable layout system
 Graphical data presentation

Mobile Information Device Profile (MIDP)


What Does Mobile Information Device Profile
(MIDP) Mean?
Mobile Information Device Profile (MIDP) is a specification for the use of Java
technology for mobile devices. In the context of software development,
MIDP sits on top of the Connected Limited Device Configuration (CLDC).
Because MIDP is primarily used with CLDC, which is designed for highly
constrained devices with limited CPUs, screen size, RAM, battery power and
user interface, midlets are ideal for low-end cell phones.

Applications written with MIDP are normally designed for cell phones and
PDAs. They are known as midlets.

Techopedia Explains Mobile Information Device


Profile (MIDP)
Some commonly-used MIDP development tools include the Sun Java
Wireless Toolkit and the Netbeans Mobility Pack.

In theory, applications written using MIDP and CLDC should have the ability
to run on different Java ME-capable devices without any changes in their
code, which is consistent with Java’s "write once, run anywhere" mantra. In
practice, however, varying hardware specifications among devices, such as
graphical display sizes/resolutions and user interfaces, force developers to
make additional customizations.

MIDP 3.0, released in 2009, supports the following features (not an


exhaustive list):

 Shared libraries for midlets


 Improved cross-device interoperability
 Improved UI expressability and extensibility
 Support of devices with larger displays
 High-performance games
 Auto-launched midlets
 Inter-midlet communications

2nd module unit=1


Memory Management in Android
Java has automatic memory management. It performs routine garbage collection to
clean up unused objects and free up the memory. However, it is very important for us to
know how the garbage collector works in order to manage the application’s memory
effectively. Thus avoiding OutOfMemoryError and/or StackOverflowError exceptions.

Let’s start with the memory structure first. For effective memory management, JVM
divides memory into Stack and Heap.

Stack Memory

Java Stack memory is used for the execution of the thread. They contain method-
specific values which that are short-lived and references to the other objects in the heap
that are getting referred from the method.

Example:

public void methodA() {


int a = 10;
methodB(a);
}
public void methodB(int value) {
int b = 10;
//Rest of the code.
}
From the above picture, it is clear that local variables of the respective method will be
created in the same frame. For example, variable “b” of “methodB” can be accessed by
“methodB” only and not by “methodA”, as “methodA” is in separate frame. Once the
“methodB” execution is completed, the control will go to the calling function. In this case,
it’s “methodA”. Thus, the frame for “methodB” will be removed from the stack and all the
variables in that frame will also be flushed out. Likewise, for “methodA”.

Heap Memory

Java heap space is used to allocate memory to the objects. Whenever we create
Java/Kotlin objects, these will be allocated in the Heap memory.

Garbage collection process runs in the heap memory. Let’s go through the basic
garbage collection process and structure of the heap memory in detail

Contents

 1 Garbage Collection Process

 2 Types of Garbage Collectors


 3 Concurrent Mark & Sweep (CMS) Collector

 4 ART GC Overview

 5 Restricted App Memory

 6 Tools to detect memory leaks


 7 Conclusion

Garbage Collection Process

Garbage Collection is a process of cleaning up the heap memory. Garbage collector


identifies the unreferenced objects and removes them to free the memory space.

The objects that are being referenced are called ‘Live objects’ and those which are not
referenced are called ‘Dead objects’.

This process can be triggered at any time and we don’t have any control over it. We can
also request the system to initiate GC process in case we want to. But there is no
guarantee that it will be initiated by the system, it is up to the system to decide.

Let’s go through the basic process involved in Garbage collection.

Step 1 : Marking

Most of us think that Garbage Collector marks dead objects and removes them. In
reality, it is exactly the opposite. Garbage Collector first finds the ‘Live objects’ and
marks them. This means the rest of the objects that are not marked are ‘Dead objects’.

Step 2 : Normal Deletion

Once Garbage Collector finds the ‘Dead objects’, it will remove them from the memory.

Step 3 : Deletion with Compacting


Memory allocator holds the reference of the free memory space and searches for the
same whenever new memory has to be allocated. In order to improve performance, it is
better if we move all the referenced objects to one place. Thus, this step helps in
improving the memory allocation process.

Basic GC process

This algorithm is called a mark-sweep-compact algorithm.

As the number of objects increase, the above process i.e., Marking, Deletion and
Deletion with compacting is inefficient. As per the empirical analysis, most objects are
short-lived. Based on this analysis, the heap structure is divided into three generations.

Heap Structure

The heap structure is divided into three divisions namely, Young Generation, Tenured
or Old Generation, and Permanent Generation.
Types of Garbage Collectors

 Serial GC
 Parallel GC
 Concurrent Mark and Sweep (CMS) collector
 G1 Collector

These garbage collectors have their own advantages and disadvantages. As Android
Runtime (ART) uses the concept of CMS collector, we will only discuss Concurrent
Mark and Sweep (CMS) Collector here.

GC Algorithms

An important aspect to remember is that, usually two different GC algorithms are


needed – one for the Young generation and the other for the Old generation.

Concurrent Mark & Sweep (CMS) Collector

This collector is used to avoid long pauses during the Garbage collection process. It
scans heap memory using multiple threads. It uses parallel Stop the World mark-copy
algorithm in the young generation and concurrent mark-sweep algorithm in the Old
Generation.
Design and Architectural Patterns in
Android – An Introduction
A design pattern can be defined as a general repeatable solution to a commonly occurring problem
in software design. It won’t be the exact solution whereas it would just give a template to solve a
solution.

Why design patterns?

•They give the developer a selection of tried and tested solutions to work with

•They are language neutral and so can be applied to any language that supports object-orientation

•They aid communication by the very fact that they are well documented and can be researched if
that is not the case.

•They have a proven track record as they are already widely used and thus reduce the technical risk
to the project

•They are highly flexible and can be used in practically any type of application or domain

Types of Design Patterns:

Creational Patterns

These design patterns provide a way to create objects while hiding the creation logic, rather than
instantiating objects directly using the new operator. This gives the program more flexibility in
deciding which objects need to be created for a given use case.

Structural Patterns

These design patterns concern class and object composition. The concept of inheritance is used to
compose interfaces and define ways to compose objects to obtain new functionalities.

Behavioural Patterns

These design patterns are specifically concerned with communication between objects.

Two main reasons for many codes to be in such bad shape is,
1. Continuous changes in UI.
2. Lack of an architecture that supported the flexibility that we needed.

Architectural patterns are used to overcome these problems.


Architectural Patterns in Android:

The three most commonly used Architectural Patterns in Android are

 MVC(Model View Control)


 MVP(Model View Presenter)
 MVVM(Model View View Model)
Model:
The Model represents a set of classes that describe the business logic i.e. business model as well as
data access operations i.e. data model. It also defines business rules for data means how the data can
be changed and manipulated.

View:
The View represents the UI components like CSS, jQuery, HTML etc. It is only responsible for
displaying the data that is received from the controller as the result. This also transforms the model(s)
into UI.

MVC(Model View Control):


The Controller is responsible to process incoming requests. It receives input from users via the View,
then processes the user’s data with the help of Model and passing the results back to the View.
Typically, it acts as the coordinator between the View and the Model. The Architecture of MVC is
given below.

MVP(Model View Presenter):

The Presenter is responsible for handling all UI events on behalf of the view. This receive input from
users via the View, then process the user’s data with the help of Model and passing the results back
to the View. Unlike view and controller, view and presenter are completely decoupled from each
other’s and communicate to each others by an interface. The architecture of MVP is shown below.

MVVM(Model View View Model):

The View Model is responsible for exposing methods, commands, and other properties that help to
maintain the state of the view, manipulate the model as the result of actions on the vie w, and trigger
events in the view itself.

Simply any change that takes place within the model will be automatically updated in the view itself.
The Architecture of MVVM is shown below.
What are the Techniques for
Composing Applications in android
March 27, 2022 by StarTech City

In Android, there are so many techniques that are used to build an application.
And in this article, we are going to learn the BEST Techniques for composing
applications in android that are commonly used in GUI environments. We follow
many approaches; every developer or company has its thinking and techniques to
build an application but three are the most popular ones that are used by 90% of
the developers. Each technique has its advantages and disadvantages. Developers
choose techniques according to their needs.

Types of Techniques for composing applications


in android
Composing application techniques include the MVC
(Model View Controller) model, Event based
programming, and the use of auxiliary files.

There are Mainly Three types of techniques for composing applications.


1. MVC (Model View Controller) Model.
2. Event-Based Programming.
3. Auxiliary Files.
Now let’s deep dive into these techniques & elaborate in detail.

Event-Based Programming
Event-Based Programming is based on generating events for every GUI element.
This approach makes GUI an event generator & reflects the choice of users. The
flow of the program and work depends on events. It is asynchronous
programming or model.

For Example: hovering the mouse or cursor over a button or link, or clicking on a
button or link may reflect other choices or significance.

How does event-driven programming work

It is like a producer generating an event and sending it to the subscriber. For


Example, A server has an alarm system that rings at 10 am and sends a signal to
its client about time. First Producers generate the events in form of an alarm, then
Servers handle the event generated by producers and send them to clients in
form of events to ring the alarm. Through this user sitting on the client -side get
to know about time.

Flowchart
MVC (Model View Controller) model
The Second Composing Application Technique in android is MVC. It is divided
into 3 parts, Model, View, and Controller. It is the way the information, and data is
been presented to the user & how the user interacts with the view.

 Model: Stores the application data, Handle network layer as well as


database, with no information about the user interface. Manages business
logic and rules of the application. In other words, what to render.
 View: It is the UI design. Offers User interaction, how to display data to the
users, or provides visualization of the data from the Model. In simple
words, how to render.
 Controller: Contains core application logic, gets notified of the user’s
behavior, establishes a relationship between Model and View, and updates
the Model as it needs. In simple words, handle events, and user inputs.

In MVC, Controller and View depend on the Model. Controller to Update the data
or result, View to get the data.

MVC is of 2 types:

 Passive Model: The controller modifies or manipulates the model and


notifies the View to update, View gets data from the Model. In other words,
the Controller is the only class to manipulate the Model.
 Active Model: The controller is not only the class to modify or manipulate
the Model. Use Observer Pattern. The model notifies the view by an
interface called Observer. The observer is always watching for updates,
whenever the Model gets updated, it sends the request to View.
Auxiliary Files
Auxiliary files are used to describe attributes of applications, such as Binary data,
language settings, and structural properties including menus.

Common Auxiliary files are Menu, Binary Data, Localization Information, etc.

The importance of auxiliary files is increasing. Mobile devices are improved and
wireless facilities have been increasing. Auxiliary files are a considerable factor of
memory consumption to handle the auxiliary data, we use many resources which
are unnecessary and may use memory.

Auxiliary files needed by applications are many. For instance, there can be data
files whose contents are needed for creating a valid initial state. Usually, one
should compose applications so that even if some of the data files are missing, it
would be possible to run the application.

irebase Creating Dynamic Link


In Firebase, there are four ways through which we can create Dynamic Link. These are
as follows:

Using the Firebase console


We can create a dynamic link with the help of the Firebase console. It is useful if we are
creating promo links to share on social media. We can select a custom suffix and a name
for the link in the Firebase console. We can track the performance of these Dynamic
Links in the Firebase console or via the Analytics REST API.

Using the Dynamic Link Builder API


It is the preferred way to dynamically create links in our app for user-to-user sharing or
in any situation that requires many links. We can track the performance of Dynamic
Links, which are created with the Builder API using the Dynamic Links Analytics API.

Using the REST API


It is the preferred way to dynamically create links on platforms which don't have a
Builder API. The Analytics REST API can be used to track the performance of promo
campaigns created in the console.

Concurrency In android

The Android SDK, as it is based on a subset of Java SDK, derived from the Apache
Harmony project, provides access to low-level concurrency constructs such
as java.lang.Thread, java.lang.Runnable, and the synchronized and volatile keywords.

These constructs are the most basic building blocks to achieve concurrency and
parallelism, and all the high-level asynchronous constructs are created around these
building blocks.

The most basic one, java.lang.Thread, is the class that is mostly used and is the
construct that creates a new independent line of execution in a Java program:

public class MyThread extends Thread {

public void run() {

Log.d("Generic", "My Android Thread is running ...");

} Copy

In the preceding code, we subclassed java.lang.Thread to create our own independent


line of execution. When Thread is started, the run method will be called automatically
and it will print the message on the Android log:

MyThread myThread = new MyThread();

myTread.start(); Copy

At this time, we will create an instance of our MyThread, and when we start it in the
second line, the system creates a thread inside the process and executes
the run() method.
Other helpful thread-related methods include the following:

 Thread.currentThread() :This retrieves the current running instance of the thread


 Thread.sleep(time): This pauses the current thread from execution for the given
period of time
 Thread.getName() and Thread.getId(): These get the name and TID, respectively
so that they can be useful for debugging purposes
 Thread.isAlive() : This checks whether the thread is currently running or it has
already finished its job
 Thread.join() : This blocks the current thread and waits until the accessed thread
finishes its execution or dies

The Runnable interface, which is another building block that comes from the Java API, is
an interface defined to specify and encapsulate code that is intended to be executed by
a Java thread instance or any other class that handles this Runnable:

package java.lang;

public interface Runnable {

public abstract void run();

} Copy

In the following code, we basically created the Runnable subclass so that it implements
the run() method and can be passed and executed by a thread:

public class MyRunnable implements Runnable {

public void run(){

Log.d("Generic","Running in the Thread " +

Thread.currentThread().getId());

// Do your work here

...

}
} Copy

Now our Runnable subclass can be passed to Thread and is executed independently in
the concurrent line of execution:

Thread thread = new Thread(new MyRunnable());

thread.start(); Copy

While starting new threads is easy, concurrency is actually a very difficult thing to do.
Concurrent software faces many issues that fall into two broad categories: correctness
(producing consistent and correct results) and liveness (making progress towards
completion). Thread creation could also cause some performance overhead, and too
many threads can reduce the performance, as the OS will have switch between these
lines of execution.

Android Resources (Resources)


management
There are many things used to build an excellent Andro id app. In additio n to
coding the application, you need to focus on a variety of resources, such as you
use a variety of static content, such as bitmaps, co lors, layout definition, user
interface strings, animation and so on. These resources are generally placed in
the project's res / standalone subdirectory.

This section of the tutorial will learn how to organize your applicatio n resources,
specify alternative resources, and access them in your application.

Alternative Resources
Your applicatio n needs to provide resources to support an alternative
configuration for a specific device. For example, you need to provide an
alternative picture of resources for different screen reso lutio ns, providing an
alternative string resources for different languages. At runtime, Andro id detects
the current device configuration, and load the appropriate resources for an
application.
To identify a set of alternative resources for specific configuration, following the
steps of:

 Create a new directory res / down to <resource_name> _


<config_qualifier> are named. Here resources_name any resources
mentioned in the table, such as layout and pictures. qualifier w ill
determine what resources to use personalized co nfiguration. You can see
the official documentation for a complete list of the different types of
resources qualifier.
 Saving alternative resources in response to this directory. These resource
files must show the default resource file name is consistent w ith the
following examples, however, these do cuments will determine the
contents of the substitution. For example: While the picture's file name
the same, but the screen reso lutio n of the picture resolution will be
higher.

Here is an example, to specify the default picture of the screen and high-
resolution image substitutio n.

MyProject/
src/
main/
java/
MyActivity.java
res/
drawable/
icon.png
background.png
drawable-hdpi/
icon.png
background.png
layout/
activity_main.xml
info.xml
values/
strings.xml
access to resources
In application development, we need access to defined resources, either
through code or through XML files. The follow ing sections describe how to
access these resources separately in two scenarios.

In the code to access resources


When the Android application is compiled to generate a class R, w hich contains
the ID and all res / directory resources. You can use the class R, + by subclass
resource name or directly use the resource ID to access resources.

Examples
Access res / drawable / myimage.png, and set it to the ImageView, you would
use the follow ing code:

ImageView imageView = (ImageView) findViewById(R.id.myimageview);


imageView.setImageResource(R.drawable.myimage);

Integrate the plugin


bookmark_border
This page describes how to download, import, and configure the Unity plugin
for Android Performance Tuner.

Requirements
To use the plugin in your game, use a supported version of Unity:

 Unity version 2017.4 or later and .NET version 4.6


 To use APK Expansion files, Unity 2018.2 is required
 For improved frame pacing and GPU measurements, Unity version 2019.3.14
or later is required
 For Addressables scenes support, Unity 2019.3 or later and Addressables
package 1.19.4 or later are required.

Download the plugin


Download the plugin from the GitHub repository. Select the .unitypackage file
download.

Import the plugin


Before importing the plugin, make sure your project is using .NET version 4.6.
This applies to Unity version 2018.4 and earlier (later versions of Unity contain
.NET version 4.6 only).

1. Select File > Build Settings. Make sure Android is selected as the current
platform.
2. Click the Player Settings button.
3. Under Other Settings, find Scripting Runtime Version and select .NET 4.6.

The plugin is provided as a Unity Package that you can import in your project.
Select Assets > Import Package > Custom Package and select
the .unitypackage file you downloaded.
Android Performance Tuner version 1.5.1 or higher with Unity 2017

Using Android Performance Tuner version 1.5.1 or higher with Unity


2017 requires the following additional steps when importing the plugin:
1. Go to the Assets/AndroidPerformanceTuner/Editor folder.
2. Click the Google.Android.PerformanceTuner.Editor file to open it in
the Inspector.
3. Click the missing assembly reference and then click - to remove it.
4. Click the Apply button.

Figure
1. Missing assembly reference.
5. Go to the Assets/AndroidPerformanceTuner/Runtime folder.

6. Click the Google.Android.PerformanceTuner file to open it in the Inspector.

7. Repeat step 3 to remove the two missing assembly references.

8. Restart Unity.

9. Go to Window > AndroidPerformanceTuner > Setup and verify that no


errors are displayed.
Re-importing the plugin after deletion

If you're re-importing the plugin after removing it from the project,


remove ANDROID_PERFORMANCE_TUNER_UTILITIES from Player Settings >
Scripting Define Symbols first.

Configure the plugin


To configure the plugin, do the following:

1. For Unity version 2019.3.14 or later:


 Enable the Android Frame Pacing library. Android Performance Tuner will use
this library to measure the performance of your game, including more in-depth
measures than what Unity alone reports.
Select File > Build Settings and click the Player Settings button.
Under Resolution and Presentation, select the Optimized Frame
Pacing checkbox.

 Synchronize the frame rendering with vertical blanks.


From the Player Settings, select the Quality tab and find the VSync
Count menu. Use any selection (except Don't Sync). Selections other
than Don't Sync enable more precise measurements in conjunction with the
Android Frame Pacing library.

2. (For versions of Unity prior to 2019) Set the build system to Gradle.
Select File > Build Settings. Find Build System and select Gradle.

3. Add the internet access permission. Under Other Settings, find Internet
Access and select Require.

4. Enter your API key. Once the plugin is installed, you can enter it from
the Window > Android Performance Tuner > Setup menu. On this dialog,
select the Settings tab and enter the API key from your Google Cloud
project into the API key field.
Note: If you don't enter your API key, Android Performance Tuner won't send
your game pe

You might also like