Define: ANDROID | ANDROID SDK FEATURES

Define: ANDROID

       
The first truly open and comprehensive platform for mobile devices. It includes an operating system, user-interface and applications — all of the software to run a mobile phone but without the proprietary obstacles that have slow down mobile innovation


ANDROID version 10 Q

ANDROID SDK FEATURES

GSM, EDGE, 3G, 4G, and LTE networks for telephony or data transfer, enabling you to make or receive calls or SMS messages, or to send and retrieve data across mobile networks

Comprehensive APIs for location-based services such as GPS and network-based location detection

Full support for applications that integrate map controls as part of their user interfaces

Wi-Fi hardware access and peer-to-peer connections

Full multimedia hardware control, including playback and recording with the camera and microphone

Media libraries for playing and recording a variety of audio/video or still-image formats

Libraries for using Bluetooth and NFC hardware for peer-to-peer data transfer

Home-screen Widgets and Live Wallpaper

An integrated open-source HTML5 WebKit-based browser

Access to Hardware, Including Camera, GPS, and Sensors


Android includes API libraries to simplify development involving the underlying device hardware.

They ensure that you don't need to create specific implementations of your software for different devices, so you can create Android applications that work as expected on any device that supports the Android software stack.

The Android SDK includes APIs for location-based hardware (such as GPS), the camera, audio, network connections, Wi-Fi, Bluetooth,sensors(including accelerometers), NFC, the touch screen, and power management.


Background Services

Android supports applications and services designed to run in the background while your application 
isn't being actively used.

Modern mobiles and tablets are by nature multifunction devices; however, their screen sizes and
interaction models mean that generally only one interactive application is visible at any time.
Platforms that don't support background execution limit the viability of applications that don't need 
your constant attention.

Background services make it possible to create invisible application components that perform automatic processing without direct user action.

Background execution allows your applications to become event-driven and to support regular updates, which is perfect for monitoring game scores or market prices, generating location-based alerts, or prioritizing and prescreening incoming calls and SMS messages.

Notifications are the standard means by which a mobile device traditionally alerts users to events that have happened in a background application. Using the Notification Manager, you can trigger audible alerts, cause vibration, and flash the device's LED, as well as control status bar notification icons.

The servlet life-cycle | jwt life-cycle | java servlet life-cycle

The servlet life-cycle 


A servlet life cycle can be defined as the entire
process from its creation till the destruction. The
following are the paths followed by a servlet.

The servlet is initialized by calling
the init() method.

The servlet calls service() method to process a
client's request.

The servlet is terminated by calling
the destroy() method.

Finally, servlet is garbage collected by the garbage
collector of the JVM.

The init() Method


The init method is called only once. It is called only when the
servlet is created, and not called for any user requests
afterwards.


So, it is used for one-time initializations, just as with the init
method of applets.


The servlet is normally created when a user first invokes a URL
corresponding to the servlet, but you can also specify that the
servlet be loaded when the server is first started.

When a user invokes a servlet, a single instance of each
servlet gets created, with each user request resulting in a new
thread that is handed off to doGet or doPost as appropriate.

The init method definition 
public void init() throws ServletException
{
// Initialization code...
}

The service() Method

The service() method is the main method to perform the
actual task.

The servlet container (i.e. web server) calls the service()
method to handle requests coming from the client(
browsers) and to write the formatted response back to
the client.

Each time the server receives a request for a servlet, the
server spawns a new thread and calls service. The
service() method checks the HTTP request type
 (GET,POST, PUT, DELETE, etc.) and calls doGet, doPost, doPut,
doDelete, etc. methods as appropriate.

Here is the signature of this method

public void service(ServletRequest request,
ServletResponse response) throws ServletException,
IOException
{

}

The service () method is called by the container and service method
invokes doGet, doPost, doPut, doDelete, etc. methods as appropriate.
So you have nothing to do with service() method but you override either
doGet() or doPost() depending on what type of request you receive
from the client.

The doGet() and doPost() are most frequently used methods with in
each service request. Here is the signature of these two methods.
The doGet() Method

A GET request results from a normal request for a URL or from an
HTML form that has no METHOD specified and it should be handled by
doGet() method.

Public void doGet(HttpServletRequest request, HttpServletResponse
response) throws ServletException, IOException
{
// Servlet code
}

The doPost() Method
A POST request results from an HTML form that specifically lists POST
as the METHOD and it should be handled by doPost() method.

public void doPost(HttpServletRequest request, HttpServletResponse
response) throws ServletException, IOException
{
// Servlet code
}


The destroy() Method


The destroy() method is called only once at the end
of the life cycle of a servlet.

This method gives your servlet a chance to close
database connections, halt background threads,
write cookie lists or hit counts to disk, and perform
other such cleanup activities.

After the destroy() method is called, the servlet
object is marked for garbage collection. The destroy

method definition looks like this −
public void destroy()
{
// Finalization code...
}

What are Servlets? | Servlets Tasks |

What are Servlets?


Java Servlets are programs that run on a Web or Application
server and act as a middle layer between a requests coming
from a Web browser or other HTTP client and databases or
applications on the HTTP server.

Servlet

Servlets Tasks


1. Read the explicit data sent by the client.
2. Read the implicit HTTP request data sent         by the browser.
3. Generate the results.
4. Send the explicit data (i.e., the document)      to the client.
5. Send the implicit HTTP response data.

Servlet definition

Java Servlets are programs that run on a Web or Application
server and act as a middle layer between a requests coming
from a Web browser or other HTTP client and databases or
applications on the HTTP server.


Servlets typically extend HttpServlet and override doGet or doPost,
depending on whether the data is being sent by GET or by POST.
If you want a servlet to take the same action for both GET and POST
requests, simply have doGet call doPost, or vice versa.
doGet
Notice that there is no main() method in above program. When user
enters a URL on the address line of browser the browser sends the
request and the servlet’s doGet() method is called by the Container
(tomcat).
doGet method takes two arguments: HttpServletRequest and
HttpServletResponse
HttpServletRequest lets you get all of the incoming data; like form/
query data, request headers.
HttpServletResponse lets you send document content and response
headers back to the client.
doGet method throw two exceptions ServletException and IOException
you need to include them in method signature.
You can get a PrintWriter from the response object. Use the PrintWriter
object to send document content to the browser.

Featured Post

Define: ANDROID | ANDROID SDK FEATURES

Define: ANDROID         The first truly open and comprehensive platform for mobile devices. It includes an  operating system, user-int...