TAILIEUCHUNG - Lập trình Androi part 38

kỳ vọng là hầu hết, nếu không phải tất cả, các thiết bị Android sẽ có sẵn trong truy cập Internet. Đó có thể là Wi-Fi, dịch vụ dữ liệu di động (EDGE, 3G, vv), hoặc có thể là một cái gì đó khác hoàn toàn. Bất kể, hầu hết mọi người, hoặc ít nhất là những người có một kế hoạch dữ liệu hoặc Wi-Fi truy cập sẽ có thể nhận được vào Internet từ điện thoại Android của họ. | Chapter Communicating via the Internet The expectation is that most if not all Android devices will have built-in Internet access. That could be Wi-Fi cellular data services EDGE 3G etc. or possibly something else entirely. Regardless most people or at least those with a data plan or Wi-Fi accesswill be able to get to the Internet from their Android phone. Not surprisingly the Android platform gives developers a wide range of ways to make use of this Internet access. Some offer high-level access such as the integrated WebKit browser component. If you want you can drop all the way down to using raw sockets. In between you can leverage APIs both on-device and from third-party JARs that give you access to specific protocols HTTP XMPP SMTP and so on. The emphasis of this book is on the higher-level forms of access the WebKit component discussed in Chapter 13 and Internet-access APIs discussed in this chapter . As busy coders we should be trying to reuse existing components versus rolling our own on-the-wire protocol wherever possible. REST and Relaxation Android does not have built-in SOAP or XML-RPC client APIs. However it does have the Apache HttpComponents library baked in. You can either layer a SOAP XML-RPC layer atop this library or use it straight for accessing REST-style web services. For the purposes of this book REST-style web services are considered simple HTTP requests for ordinary URLs over the full range of HTTP verbs with formatted payloads XML JSON etc. as responses. More expansive tutorials FAQs and HOWTOs can be found at the HttpClient web site http . Here we ll cover the basics while checking the weather. 253 254 CHAPTER 25 Communicating via the Internet HTTP Operations via Apache HttpClient The HttpClient component of HttpComponents handles all HTTP requests on your behalf. The first step to using HttpClient is not surprisingly to create an HttpClient object. Since HttpClient is an interface you will need to actually instantiate some .

Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.