In recent years, "cloud computing" concept is very hot, "cloud computing" the core is a large number of network resources to unify, to provide users with efficient and convenient software services. What the "cloud" advocates want is that users use software services that are as easy, anytime, and on demand as they are with electricity and water. In the "Cloud computing" Network application mode, users can access the "cloud" through various "end", "end" can be any electronic devices that can be connected to the Internet, "cloud" is the service provided, "cloud" may be huge, even into one, without Borders, may be small, isolated, in short, it is everywhere, can provide the various services that the user needs. The cloud application sample figure is shown in Figure 15-1.
broadcast to Tencent Weibo
Figure 15-1 Cloud application Example
Typical Cloud Application urban weather Information Service
With the advent of the 3G network era, the speed of mobile network is greatly improved, which makes the demand of cloud and end application software become more and more big. "Cloud" must be "landed" in any case, that is, must have mobile terminal equipment and the corresponding software support.
There are many examples of "cloud" applications on the Android platform, such as Gmail (Figure 15-2), calendar, and Google Map pre-installed on Android.
This chapter introduces the application of cloud and end by a case study of weather information based on the Android system. The basic function of this chapter is to start the software into the initial screen, the initial screen shows the list of major cities in China, as shown in Figure 15-3.
broadcast to Tencent Weibo
map 15-2 GMail
broadcast to Tencent Weibo
Figure 15-3 Weather Query System interface
when the user touches one of the cities, a dialog box pops up, listing the weather information for the city and the next 4 days in the dialog, as shown in Figure 15-4.
broadcast to Tencent Weibo
Figure 15-4 Weather information
broadcast to Tencent Weibo
Figure 15-5 Demand case diagram
The requirement case diagram for this case is shown in Figure 15-5.
What technologies will be involved to implement this Android weather information query case?
First is the UI section, the UI controls used in this system are primarily ListView controls, which are described in the previous chapters of this control, not the focus of this chapter. In addition to the UI, there are 3 core issues in developing this system:
Where the data can be obtained;
• What technology is used to obtain;
L How to parse after obtaining data.
Where to get this data, which is the source of information data, the information here can be divided into the name of China's major cities and the city's current weather information in two parts. The latter is slightly different from other Android database applications, where the current weather information is unlikely to be available from the local mobile database. The reason is very simple, is that these data are real-time dynamic changes, is unpredictable, so only from the "others" there, where "others" is often said "cloud" in the "cloud." The cloud can provide the data we need as needed. Use the Weather information service provided by Google in the case. For the former, because the data is fixed, it can be hard-coded into the program or put on the mobile phone database, but the source of the data in this case is Google's World City information services provided.
What technology is used to get data? The key to solving this problem is what kind of "cloud" (server-side) to use, because the above two Google services are using HTTP protocol, so you can use some Java Support HTTP protocol network communication technology. In addition to the HTTP protocol, there are many technologies that can be used, such as sockets and Web service, but all depend on what form of API The cloud is open to.
How do I parse after I get the data? This problem also depends on the "cloud" in use, in general, the "cloud" will provide a variety of forms of data to meet the needs of different users. In this example, the two Google services, which return data formatted with JSON and XML, can be parsed using different techniques for these formats. The technology of cloud and end is mainly network communication.
To sum up, complete the case used in the knowledge and technology as follows several aspects of the content, later to introduce you.
1 network communication technology and realization;
2 data exchange;
3 Custom server-side program instance.