Preface
This chapter describes the developer Guide (Dev Guide), Web Applications, and Web Apps Overview. The version is Android 3.2 r1. Translated from: "happyjiahan". The reviewer is: "tieqi_pulee ", thanks again for "happyjiahan "! We look forward to your participation in translation of Android related information, contact me over140@gmail.com.
Statement
You are welcome to repost, but please keep the original source of the article :)
Blog Garden: http://www.cnblogs.com/
Android Chinese translation group: http://goo.gl/6vJQl
Web Apps Overview
Translator's signature: happyjiahan
Review: tieqi_pulee
Version: Android 3.2 r1
There are two methods to publish an application on android: Client-Side mode) (client-based applications need to be developed using Android sdkand install a file suffixed with .apk on the user's device ), the other is browser-based web applications (browser-based application development must follow web standards and access your developed applications through a web browser, you do not need to install any other programs on your device ).
Figure1.You can provide your web content in two ways: one is through a traditional browser, the other method is to include a WebView component in the layout file of the Android application.
So in your software development process, should you choose the client-based mode (C/S) or browser-based mode (B/S? In fact, there are many factors to consider. You should determine which mode is more appropriate based on the software you have developed. This is not the focus of our current discussion. Let's take a look at what Android provides us with to facilitate our web program development support!
* A series of window properties are supported. These properties allow you to correctly determine the window size of your web application based on the screen size.
* Supports css and javascript features. These features allow you to use different styles and image resources based on the pixel density of the screen.
Therefore, when you decide to develop a web application for android, you can ignore the support for multiple screen problems. It is easy to make your web pages on the screens of various android devices.
Another good feature provided by Android is that you do not need to build your applications on the client or web. You can integrate the two. You can develop a client-based android Application, but some web pages are embedded in this application (you can useWebView
). Figure 1 visualizes how you access a web page through a browser or android Application. However, you should not develop an android app simply to run a web site. On the contrary, web pages embedded in your android Application should be designed specifically for certain application scenarios. You can also define an interface between the android Application and your web page. This interface allows javascript on your web page to call the API in your android application.
Starting from Android 1.0,WebView
You can
android
Embedded in the layout file of the application
web
Content and pass
javascript
Call
android api
. In
android
After supporting screens with different resolutions,
android 2.0
In
WebKit
The framework allows you to specify
WindowsAttribute support, and can query the screen resolution, so that you can better modify the style and image resources mentioned above. Because these features are
Android
Medium
WebKit
Part of the framework
,
So no matter
Android
Browser or
WebView
Both the View Interface and screen resolution have the same features.
If you want to develop web applications for Android devices, read the following documents:
Targeting Screens from Web Apps
How can your web applications be properly displayed on Android devices and support multiple screen resolutions? If you are creating a web application and want your application to run on at least Android devices (assuming your application is fully deployed on the Network ), especially if you are targeting mobile terminals or are planning to useWebView
,
The information described in this document is very important to you.
Building Web Apps in WebView
How to UseWebView
Embed a Web page into an Android application and use JavaScript to call the Android API.
Debugging Web Apps
How to Use the JavaScript console API to debug web applications.
Best Practices for Web Apps
It lists a series of practical skills you should follow to help you create web applications that can run efficiently on Android devices.