Recently, the concept of "cloud computing" is quite hot. The core of "cloud computing" has also begun to unite a large number of network resources to provide users with more convenient and efficient services. "Cloud computing" developers hope: Users to use software services just as electricity and water, more convenient, anytime, anywhere, on-demand use of cloud services. In the "cloud computing" network application mode, users can access the cloud through various terminals, and various terminals can refer to any device capable of accessing the Internet. Cloud computing is a service provided. The cloud can be huge and connected , Borderless, may also be small, independent, in short, it is ubiquitous, to provide users with almost all the services they need.
Typical cloud application city weather information service
With the advent of the 3G network era, the speed of the mobile network is greatly improved, thereby increasing the demand for cloud and end application software. In any case, "cloud" must be "floating", that is, it must have a mobile terminal device and corresponding software support.
There are many examples of "cloud" applications on the Android platform, such as Gmail preinstalled on the Android system (Figure 15-2), calendars and Google Maps.
This chapter introduces a cloud and client application technology through a case study of weather information based on Android system. The basic function to be realized in this chapter is to enter the initial screen after the software starts, and the initial screen displays a list of the major cities in China, as shown in Figure 15-3.
When the user touches one of the cities, a dialog box pops up in which the weather information of the city and the next four days are listed.
To achieve this Android weather information query cases, what technology will be involved?
The first is the UI section, the UI controls used in this system are mainly ListView controls, the control section has been introduced in the previous section, not the focus of this chapter. In addition to the UI, there are three core issues in developing this system: where to get the data, what techniques to use it, and how to parse the data.
From where you can get these data, that is, the source of information data, the information here can be divided into China's major city names and the current weather information of a city in two parts. The latter is slightly different from other Android database applications where current weather information for a city is not available from the local mobile database. The reason is that the data are unpredictable in real time and therefore can only be obtained from "other people," where "others" are often referred to as "clouds" in "cloud computing." The "cloud" can provide the data we need on demand. In our case, use the weather information service provided by Google. For the former, because the data is fixed, the data can be hard-coded into the program or into the database on the mobile terminal, but the source of the data in this case is the World City Information Service provided by Google.
What technology to use to get the data? The key to solve this problem is what kind of "cloud" (server-side), as the above two Google services are used HTTP protocol, so you can use some of Java's HTTP protocol support network communication technology . In addition to the HTTP protocol, there are many other technologies that can be used, such as Socket and Web Services, but all rely on what kind of API the "cloud" is open to.
How to solve the problem after obtaining the data? The problem also depends on the "cloud" used. Generally speaking, the "cloud" will provide various forms of data to meet the needs of different users. The two Google services used in this example, which return data in JSON and XML formats, can be resolved using different technologies for these formats. Cloud and the end of the application technology is mainly network communications.