Using Internet Resources:
Important Concepts
Android Network APIs:
Kinds of tasks they allow you to accomplish
Android Network APIs:
Two connection types available
Mobile Internet:
Wi-Fi:
Private and Public Wi-Fi access points
Android Network Connections:
Basic Considerations when using Internet Resources
Benefits of a Native Internet Applications
vs
Web Apps accessed with Browser
Android Network APIs
Connecting to an Internet Resource:
Important Classes
Android Network APIs
Two Major Packages for Networking
java. net
android. net
Android Network APIs
Connecting to an Internet Resource:
Basic Steps (HTTP Connection)
Add an INTERNET uses-permission node to the application manifest
Create a URL instance:
URL url = new URL(myFeed);
Open a connection, cast to connection type:
HttpURLConnection conn = (HttpURLConnection)url.openConnection();
Check the response code of the connection:
httpConnection.getResponseCode();
Get an InputStream from connection:
InputStream in = conn.getInputStream();
When done, disconnect:
conn.disconnect();