Android Network Programming record

Source: Internet
Author: User
Tags http authentication unix domain socket file transfer protocol ftp protocol asymmetric encryption

Simple Introduction

Read the in-depth understanding of Android network programming feels good. Today's Android network programming is a key record.


Content

Android Web-based technology and programming practices

Points Defined Descriptive narrative



IP protocol
A data-oriented protocol for message exchange networks
TCP protocol Transmission Control Protocol, transport-layer communication protocols.
UDP protocol User Datagram Protocol. Transport layer protocol.
SMTP protocol Simple Mail Transfer Protocol
Socket sockets The intermediate software abstraction layer that the application layer communicates with the TCP/IP protocol family.

There are two kinds of types: TCP sockets and UDP sockets.

TCP sockets In the guarantee reliability, adopt the time-out retransmission and the piggyback confirmation mechanism, in the flow control, adopt the Sliding form protocol, on the congestion control. The slow-start algorithm is used.
UDP sockets Compress the network data traffic into the form of a packet.
FTP protocol File Transfer Protocol, the application layer of the transport Protocol.

Can operate Apache's package directly
Telnet protocol Standard protocol for Remote login services Can operate Apache's package directly
Differences between C + + and Java sockets The socket is the original socket development interface API in Winsock. 1, the interface is different, the Java itself does not have the socket communication bottom implementation, but calls the system's underlying Winsock API two encapsulation; C + + is closer to the system-level Winsock, enabling many other underlying extensions and controls.
2, Java can be developed in support of Java Virtual machine execution.
UDP and TCP differences 1, TCP reliable, UDP unreliable
2, TCP supports the application protocol is: TELNET,FTP,SMTP,TCP can be a large number of user data transmission
3, UDP Support Application Protocol: NFS (Network File system), SNMP (Simple Network management System), DNS (primary domain Name System), TFTP universal File Transfer Protocol, etc., the user data transfer less.


4, TCP is Java.net.ServerSocket (for server side) and Java.net.Socket (for client); UDP is Java.net.DatagramSocket.
5. Stream mode and datagram mode: TCP guarantees data correctness, UDP may drop packets, TCP guarantees data order. UDP is not guaranteed.




Android basic Web technology and programming practices

Points Defined Descriptive narrative
HTTP protocol Application layer Protocol of Distributed hypermedia Information System.
/HTTP Host [":" Port][Path]
Characteristics:
1. Support C/S mode
2, simple high-speed
3. Flexible
4. No connection
5. No status
Two types of messages: Request messages, response messages.

HTTP programming
Supported features include: self-directed steering, HTTPS protocol, Proxy Server, methods (get, post, put, head, opption, connect)
Implementation: Data request, data upload, data deletion and other operations.
Actionable classes: HttpClient and URLConnection.

Json JavaScript Object notation. Lightweight text data Interchange format.

Actionable classes:
Jsonobject, Jsonarray, Jsonarray, Jsontokener, Jsonstringer.
Soap Simple Object Interview protocol. Application layer protocol.

Included elements: Envelope, Header, Body, Fault.
Html Hypertext Markup Language The methods for parsing HTML documents are:
1, the form of the expression
2. String positioning
3. HTML Parser Parser
4. Jsoup Parser
How to encrypt? Data transfer can be encrypted by adding an encryption algorithm Encryption algorithms include: self-defined displacements (others), MD5 (irreversible), symmetric encryption (DES, AES), asymmetric encryption (RSA)
The crypto package can be introduced.

Android Common Network Interface programming

Points Defined Descriptive narrative
Xml Extensible tagging Voice Creating an XML file using XmlSerializer
Dom parsing A way of parsing XML, characterized by storing the entire contents of an XML file in memory in the form of a document tree, and then using the DOM API to traverse the XML tree and retrieve the required data.

The Required classes:
Documentbuilderfactory, Document, Element, NodeList.
Sax parsing A way of parsing XML, features: event-driven, edge-loaded edge parsing. The Required classes:
XMLReader, ContentHandler, Dtdhandler, ErrorHandler, Entityresolver
Pull parsing Ditto
Rss Simple information aggregation. A format for describing and synchronizing site content. Subscribe: Blogs, news.
Email programming As the name implies: Send mail. 1. Use the system's own mail service.
2, the use of JavaMail Feature Pack to send mail.

Add decryption Encryption is the process of converting plaintext into ciphertext through cryptographic algorithms and cryptographic keys, and decryption is reversed. 1, Base64 encryption (character means binary data)
2, DES is the data Encryption Standard
3, AES is the Advanced Encryption Standard
4, MD5 use to ensure the integrity of information transmission
OAuth Authentication An open standard. Consent to third party use of the user. Four steps:
1. Obtaining an unauthorized request token
2. Obtain the user authorized request token
3, with the authorized request token change Authentication token
4. Use the authentication token to interview
The difference between DOM and sax Loading in different ways. Dom loads all content at once. The sax side loads the side reads.


Android Network module programming

Points Defined Descriptive narrative
USB programming Universal Serial Bus, a master-slave structure. The classes involved:
Usbmanager, Usbaccessory, Usbdevice, Usbendpoint
WiFi programming 802.11B Standard, the industry standard of wireless communication, features: fast speed, reliable, far away.
WiFi Direct connection technology is directly connected via WiFi.

Related classes: Wirelesssettings, Wifisettings, Accesspointdialog, Wifienabler, Wifilayer, Wifimanager, WifiState, WifiService, Wifimonitor, Wifinativie, Scanresult, Wifiinfo, Wificonfiguration.


User perspective Five layers: Hardware driver, wpa_supplicant, JNI, Wifi Api, wifisettings application.
Classes involved in direct connection: Wifip2pmanager

Bluetooth programming A wireless technology to support short-distance communication of equipment Classes involved: Bluetoothadapter, Bluetoothdevice, Bluetoothsocket
NFC Programming Technology for near-range wireless communication. 3 Modes of operation: active, passive, bidirectional. Application: Contact through, contact payment, contact connection, contact browsing. Classes involved: Nfcadapter, Ndefmessage, Ndefrecord

The application of VoIP based on SIP protocol

Points Defined Descriptive narrative
SIP protocol Session Initiation Protocol. Used to create, alter, and terminate interactive sessions, including video, voice, instant messaging, online gaming, and virtual reality, among other multimedia elements. Signaling control protocol for the application layer.
What protocol is used for transmission? UDP protocol and TCP protocol
Comparison of the + + protocol and SIP protocol 1, the use of ASN.1 and compression encoding rules of the binary method to express its message, SIP-based text protocol.
2, the multi-point control unit, all terminals to the MCU to send control messages. SIP is a distributed call model with multicast capability.
What constitutes a SIP session? Four components:
1, SIP user agent (terminal equipment)
2. SIP Enrollment Server (database that includes the location of all user agents in the domain)
3. SIP Proxy Server (interface UA session request and query the SIP register server for the address information of the recipient UA)
4. SIP redirection Server (to allow SIP Proxy Server to speak SIP session invitation information directed to the external domain)

Instant communication based on XMPP protocol

Points Defined Descriptive narrative
XMPP protocol Extensible Message Processing Site Protocol An open real-time communication protocol based on XML.

Android's xmppclient address http://asmack.freakempire.de/


Android's handling of HTML

Points Defined Descriptive narrative
HTML Processing Key class Android HTML Processing key class under the source code Frameworks/base/core/java/android/webkit folder
Key classes and descriptive narratives 1, Accessibilityinjector for WebView to inject access to the JavaScript and its related content.


2, Autocompletepopup according to the input content of their own initiative not complete
3. Browserframe the Java layer encapsulation of the frame object in the WebCore.
4, CacheManager cache management object.
5, Callbackproxy processing WebCore and UI thread message proxy class
6. Certool WebView Certificate Tool
7. Clientcerrequesthandler Processing Client certificate Request
8. Consolemessage JavaScript Console messages
9. Cookiemanager Cookie Management Object
10. Cookiemanagerclassic Cookiemanager Extended Implementation class
11, Cookiesyncmanager cookie Synchronization Management object, responsible for synchronizing the RAM and flash between the cookies data.


12, Datasorter date sorting
13. DebugFlags Debug Mark
14, Devicemotionandorientationmanager realize Devicemotion and deviceorientation
15, Devicemotionservice implement Sensoreventlistener interface. Handle direction changes.
16, Downloadlistener download monitor
17. Findactionmodecallback Search Action Callback
18. Geolocationpermissions WebView's Location JavaScript API Rights Management
19, geolocationpermissionsclassic geolocationpermissions extension class. Handles the WebKit thread that is called in the UI thread.


20, Geolocationservice package position monitoring.
21. Html5audio Audio Support class
22. Html5videofullscreen Full Screen Video view
23. Html5videoinline Embedded Video View
24. Html5videoview Browser Video View
25. Html5videoviewproxy Video View Processing class
26, Httpauthhandler processing HTTP authentication request
27, Jwebcorejavabridge for Java and WebCore Library timer and cookie object interaction Bridge
28. A useful class used by Jniutil JNI to obtain information that cannot be obtained directly from C code such as the cache folder, and to read the files in the resource bundle.
29, Jspromptresult JS result hint, prompt javascript execution result.
30, Jsresult JS results, user interaction.
31. Keystorehandler is responsible for installing the certificate into the System Key storage area. Read the certificate from the network to Certtool.
32. L10nutils is responsible for the internationalization of strings

33. Mimetypemap MIME Type mapping
34, mockgeolocation simulation location information
36. mustoverrideexception Extension Execution error
37. Overscrollglow used to achieve overscroller results
38. Plugin defines the plug-in class
39, Plugindata plug-in data
40. Pluginfullscreenholder gets the size of the container for the plug-in view. Responsible for display and other operations.
41, pluginlist Maintenance plug-in list
42, PlugInManager plug-in management class
43, Pluginstub WebView Implementation plug-in interface
44. QUADF defines a quadrilateral
45. SearchBox Search dialog Box interface
46, Searchboximpl Search dialog box interface implementation
47. Selectactionmodecallback Select Action Callback
48. Sslcertlookuptable the decision to store whether a user is using a certificate
49, Sslclientcertlookuptable Save the client certificate user choice
50. Sslerrorhandler Handling SSL Error
51. Urlutil URL using processing class
52. Valuecallback callback interface for returning data values asynchronously
53. Viewmanager View Management class, manage plug-in view
54. Viewstateserializer WebView View serialization and deserialization
55. List of historical data displayed in the Webbackforwardlist WebView object
56, Webbackforwardlistclient browsing History Processing Client interface
57, Webchromeclient Chromeclient
58. Webcorethreadwatchdog WebCore Watchdog
59, Webhistoryitem a Web page data
60. Webicondatabase Icon Database Management Object
61. Webicondatabaseclassic Webicondatabase Extension class
62. Webresourceresponse Package Resource response information
63, WebSettings webview management settings data. Obtained from the underlying via the JNI interface.
64. WebStorage Database
65, Websyncmanager data Synchronization management object. Synchronous operation for RAM data and flash data.
66. Webtextview displays the system native editing component when the HTML text input control is activated.
67. WebView View Object
68. Webviewclient Web View Customer object. The object is notified when an event occurs in the Web view.


69. Webviewdatabase Database
70, Webviewfactory WebView embedded in fragment.
71, Webviewfragment Ebview embedded in fragment.


72, Zoomcontrolbase zoom control interface.
73, zoomcontrolembedded built-in zoom control.
74, Zoommanager Maintenance WebView Zoom state.


Android Network Processing Analytics

The
Points Defined Descriptive narrative
Network processing Key class Android HTML Network processing key classes under the source Code frameworks/base/core/java/android/net folder
key class and descriptive narration 1, Connectivitymanager used to query the state of a network connection.
2, Credentials unix identity information
3, dhcpinfo   A DHCP Request result object
4, Localserversocket   Create a non-standard class for the downstream UNIX domain socket
5, Localsocket   Create a non-ServerSocket
6, localsocketaddress  socket address
7, MailTo   in the Unix domain namespace Parse the URL of the Mailto protocol format
8, networkinfo description of the network interface status
9, proxy access to the user and the default proxy settings class
10, sslcertificatesocketfactory   Additional details for SSL operations
11, Sslsessioncache  ssl Session cache
12, trafficstats   network traffic statistics
13, Uri   An immutable URL reference
14. Uri.builder   Create an auxiliary class for URL reference
15, urlquerysanitizer   Filter URL query
16, Urlquerysanitizer.illegalcharactervaluesanitizer filter illegal values with the characters they include
17, Urlquerysanitizer.parametervaluepair A simple tuple of value pairs
18, Vpnservice   Apply extensions and establish your own base class for VPN solutions
19, Vpnservice.builder   Create a secondary class for a VPN interface
 
HTTP processing classes for Android encapsulation 1, androidhttpclient (essentially Apache Defaulthttpclient class on Android implementation)
2, Defaulthttpclient (a httpclient)
3, the SSL authentication Information processing class (SSL protocol implementation and the digital certificate correlation, relates the class: Sslcertificate, Sslerror)
1. Androidhttpclient cannot be executed in the main thread, Defaulthttpclient is executed in the main thread.
2, androidhttpclient through the static method Newinstance obtains the instance. Instead, Defaulthttpclient creates the object.
3, defaulthttpclient The default startup cookie, but the default does not retain cookies, such as to retain the need to add Cookiestore to HttpContext.

Android RTP Protocol Real-time transport protocol. It is used to provide end-to-end real-time transmission service for multimedia data such as voice, image, fax and so on in IP network.


The RTP protocol specifically describes the standard packet format for delivering audio and video.

Classes involved: Audiocodec, Audiostream, Audiogroup, Rtpstream.



Summarize

This book explains the essentials of Android development in detail. and the source code case for the specific description, so that the author from the principle of deepening the understanding of the relevant knowledge points.


Android Network Programming record

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.