Android developer Guide (18) -- Web Apps Overview

Source: Internet
Author: User

 

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 canandroidEmbedded in the layout file of the applicationwebContent and passjavascriptCallandroid api. InandroidAfter supporting screens with different resolutions,android 2.0InWebKitThe framework allows you to specifyWindowsAttribute support, and can query the screen resolution, so that you can better modify the style and image resources mentioned above. Because these features areAndroidMediumWebKitPart of the framework,So no matterAndroid 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 useWebViewThe information described in this document is very important to you.

Building Web Apps in WebView

How to UseWebViewEmbed 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.

 

 

 

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.