Sidcley Soares. Introduction to Android Creating a hello world project in Android Java Sockets ...

24
Comparing Java SDK and Android SDK Socket APIs’ Sidcley Soares
  • date post

    21-Dec-2015
  • Category

    Documents

  • view

    225
  • download

    0

Transcript of Sidcley Soares. Introduction to Android Creating a hello world project in Android Java Sockets ...

Comparing Java SDK and Android SDK

Socket APIs’Sidcley Soares

Introduction to Android Creating a hello world project in Android Java Sockets Android Sockets references

Agenda

Download version 1.5 (170 mb)◦ http://developer.android.com/sdk/download.html?

v=android-sdk-windows-1.5_r2.zip◦ Eclipse IDE using ADT( Android development

Tools)

Android

Installing eclipse plugin

Creating HelloWorld project

Creating HelloWorld activity

Updating AndroidManifest.xml

Creating HelloWorld project

java.net.ServerSocket (Server) java.net.Socket (client)

More information athttp://java.sun.com/j2se/1.5.0/docs/api/java/

net/package-summary.html

Java SDK Sockets API

Java Server socket

Java Client Socket

Server◦ Client host:/127.0.0.1◦ From Java SDK

Client◦ From Java SDK - by Java SDK Server

Outputs

java.net.ServerSocket (Server)java.net.Socket (Client)

More information athttp://developer.android.com/reference/java/net/package-summary.html

ANDROID Sockets API

Android Socket client

androidManifest.xml

Server◦ Client port:2802◦ Client host:/10.159.1.132◦ From Android

Outputs (server)

Output (client)

Package android.net◦ LocalServerSocket

public LocalServerSocket (String name)◦ LocalSocket

public LocalSocket()

Android Sockets (Local Sockets)

Android Local Socket

Android Local Socket (Server)

Android Local Socket (client)

Output

Basically both APIs are the same. Android uses the java API to communicate with other applications which are outside Android.

For internal calls Android provides its own set of Sockets. It is used to communite with aplications inside Android.

Android VS Java APIs

Android◦ http://developer.android.com/guide

Java◦ http://java.sun.com/j2se/1.5.0/docs/api/index.html

References