Background technology
Previous because the hardware of embedded handhold equipment was limit, and general application program of mobile phone belongs to basically that primitive program (like C, C++, Java etc.) writes.This just causes the complicacy of application and development to strengthen, and the layman can not participate in exploitation.
And along with the making rapid progress of hardware technology, the processing power of CPU (central processing unit) is more and more stronger, portable terminals such as the smart mobile phone of the world today and PC several years ago very nearly the same.This just makes with a type XML (Extensible Markup Language; Extend markup language), HTTP (HyperText Transfer Protocol; HTTP); CS S (Cascading Style Sheet, CSS), the application program that mobile phone write in JavaScript descriptive languages such as (a kind of webpage programming languages) becomes possibility.The benefit of doing like this is to reduce development difficulty greatly, lets more people participate in the exploitation of application, thereby makes the application on mobile phone become extensive.
Develop into today, the fusion of internet and mobile communication is more and more tightr, and the general way of main flow cell phone manufacturer is to adopt traditional browser access network at present; On computers because the service of the specification of hardware and software unified standard all, can be very simple so call local service, still on portable terminals such as mobile phone; Owing to do not have unified standard and service; The application of this machine of visit (as make a phone call, multimedia application, the operation local call this etc.) very difficulty just becomes; And the application of cell phone system basically all is the primitive program exploitation; For the application of adopting the primitive program exploitation generally all need adopt specific mode go to resolve this application [as: JS (javascript, a kind of webpage programming language) expands API (Application Programming Interface, API)]; The exploitation of also make using has significant limitation, and cannot accomplish cross-platform general.
Summary of the invention
Fundamental purpose of the present invention provides a kind of development approach and terminal of the mobile phone application interface based on the browser resolves mode; Can greatly simplify the complexity that the user develops mobile phone application; Solve the compatibility between multi-platform, reduce the user and develop the difficulty of the general application at terminals such as mobile phone.
The technical solution adopted for the present invention to solve the technical problems is:
A kind of development approach of the mobile phone application interface based on the browser resolves mode, it comprises:
According to generic resource identifier URI load application data;
Said application data is resolved, generate according to analysis result and treat layout and the data structure of playing up;
According to configuration information said layout and the data structure of playing up treated drawn the interface that is applied.
Preferably, carry out application data and carry out in the resolving,, then from local file system, obtain said local data or obtain said network data from network if the data in the said application data need local data or network data.
Preferably, carry out and obtain network data, specifically comprise:, initiate request of data and download this network data to server according to said data link according to the data link that configuration information obtains this network data from network.
Preferably, carry out according to URI load application data, specifically comprise: a fixing test homepage is set, and this test homepage has comprised the URI of all application; URI according to said application loads this application data.
Preferably, the URI that carries out according to said application loads this application data, further, also comprises: carry out the initialization of application interface.
Preferably, said configuration information comprises: the window size of said application interface and positional information.
The present invention also provides a kind of terminal, comprising:
The data load unit is used for according to URI load application data;
The data parsing unit is used for said application data is resolved, and generates according to analysis result and treats layout and the data structure of playing up;
The interface forms the unit, is used for according to configuration information said layout and the data structure of playing up treated being drawn the interface that is applied.
Preferably, said data parsing unit also is used for: when the data of said application data need local data or network data, from local file system, obtain said local data or obtain said network data from network.
Preferably, said data parsing unit also is used for obtaining according to configuration information the data link of this network data, initiates request of data and downloads this network data to server according to said data link.
Preferably, said data load unit also is used to be provided with a fixing test homepage, and this test homepage has comprised the URI of all application; URI according to said application loads this application data.
The technical scheme of embodiment of the present invention has following beneficial effect: method provided by the invention and terminal, resolve based on the browser application data; Generate according to analysis result and to treat that layout draws the interface that is applied with the data structure of playing up and according to this data structure; Can greatly simplify the complexity that the user develops terminal applies such as mobile phone, solve the compatibility between multi-platform, reduce the user and developed the general difficulty of using in terminal such as mobile phone; Attract more developer to participate in application and development; Make that simultaneously the application at terminals such as mobile phone is abundanter, enrich, strengthened the competitiveness of portable terminals such as mobile phone greatly with the easier alternately of internet.
Embodiment
In order to make the object of the invention, technical scheme and advantage clearer,, the present invention is further elaborated below in conjunction with accompanying drawing and embodiment.Should be appreciated that specific embodiment described herein only in order to explanation the present invention, and be not used in qualification the present invention.
The embodiment of the invention provides a kind of development approach of the mobile phone application interface based on the browser resolves mode, realizes that the terminal of this method is as shown in Figure 1, comprising:
Application configuration unit: be used for according to the typical application standard such as W3C standard (World Wide Web Consortium; World Wide Web Consortium) use XML to carry out application configuration; Such as the spacing that is applied in position, size, literal and picture in the mobile phone window (application interface), the local data of dependence and the link of network data etc.
Application and development unit: be the place that the developer carries out application and development; Comprise application development tool (being typically text editor); Application and development interface on mobile phone window management, processing window message, JavaScript Development Framework and the external API of encapsulation browser engine; The user uses HTML (Hyper Text Mark-up Language, HTML), CSS and Java Script or Aiax (Asynchronous JavaScript and XML, asynchronous JavaScript and XML; A kind of webpage development technology of creating the interaction network page application) Application and Development is used application configuration cell layout.
Browser cell: transplant the browser engine of increasing income to cell phone platform and the simple browser that realizes, possess the function of visiting cell phone platform system service and internet, applications, through this browser cell, can use local service and network application service.
Use debugging unit: adaptive and expansion PC (Personal Computer; Personal computer) function of the mobile phone application simulator of end; Increase the debug window and the function that realize using browser engine Web Inspector (detecting device) mechanism; Can debug Java Script and HTML5, make simulator directly to utilize local TCP/IP (Transmission Control Protocol/Internet Protocol, transmission control protocol/the Internet interconnection protocol) agency through browser cell; The visit mobile Internet, thus dynamic debugging is used.
The user uses application and development unit developing application in the method; This application program depends on the configuration information of application configuration unit; This configuration information has defined application window (application interface) size; Application data (being HTML, CSS, JavaScript or Aiax program) relies on and comes from local data and network data; Application data is loaded into the browser engine of browser cell through application and development unit (that is: mobile phone application administrative section), and the parsing that browser engine mainly is responsible for application data generates carries out layout and the structure of playing up, and calls software platform GUI (Graphical User Interface then; Graphic user interface) system layout is drawn the interface that is applied with the data structure of playing up; The user uses debugging unit through the utilization of mobile phone application simulator and debugs application, and the mobile phone simulator is the simulator of PC end, connects network through TCP/IP; Accomplish the debugging of Internet service in the mobile phone application, carry out the debugging of application scenarios data JavaScript and HTML5 through Inspector mechanism Inspector debugging interface in the mobile phone application simulator of browser engine.
As shown in Figure 2, in the embodiment of the invention, may further comprise the steps based on the development approach at the mobile phone application interface of browser resolves mode:
S110, according to URI (Uniform Resource Identifier, generic resource identifier) load application data;
Specifically comprise: through the mobile phone application simulator a fixing test homepage is set, this test homepage has comprised the URI of all application; This mobile phone application simulator uses the browser engine of browser cell this application data of URI loading according to this application through the application and development unit.In a further embodiment, in order better to carry out the demonstration of application interface later, the mobile phone application simulator carries out the initialization of application interface.
S120, this application data is resolved, generate according to analysis result and treat layout and the data structure of playing up;
In this step S120, carry out in the resolving in the browser engine application data, if the data in this application data need local data or network data, then from local file system, obtain this local data or obtain this network data from network.Obtain the process of network data from network in execution; Specifically comprise: the data link that the mobile phone application simulator uses browser engine to obtain this network data according to the configuration information of application configuration unit, mobile phone application simulator use browser engine to initiate request of data and download this network data to server according to this data link.In the present embodiment, preferred, this configuration information comprises: information such as the window size of this application interface and position.
S130, this is treated that layout and the data structure of playing up draw the interface that is applied according to configuration information.
Concrete: in the process of this drafting, browser engine is obtained the size and the positional information of application window from this configuration information; Browser engine is used this application interface of the complete drafting of GUI API through the integral layout of application data; The window of mobile phone simulator shows this application interface.
The method that the foregoing description provides can greatly be simplified the complexity that the user develops terminal applies such as mobile phone; Solve the compatibility between multi-platform; Reduced the user and developed the general difficulty of using in terminal such as mobile phone, attracted more developer to participate in application and development, made that simultaneously the application at terminals such as mobile phone is abundanter; Enrich with the easier alternately of internet, strengthened the competitiveness of mobile phone greatly.
The embodiment of the invention also provides a kind of terminal, and the terminal in the embodiment of the invention has comprised whole technical schemes of previous embodiment.As shown in Figure 3, the terminal of the embodiment of the invention also comprises:
Data load unit 210 is used for according to URI load application data; More concrete, this data load unit 210 also is used to be provided with a fixing test homepage, and this test homepage has comprised the URI of all application; URI according to this application loads this application data.
Data parsing unit 220 is used for this application data is resolved, and generates according to analysis result and treats layout and the data structure of playing up; More concrete, this data parsing unit 220 also is used for: when the data of this application data need local data or network data, from local file system, obtain this local data or obtain this network data from network.In more concrete embodiment, this data parsing unit 220 also is used for obtaining according to configuration information the data link of this network data, initiates request of data and downloads this network data to server according to this data link.
The interface forms unit 230, is used for according to configuration information this being treated that layout and the data structure of playing up draw the interface that is applied.
Preferably, this configuration information comprises: information such as the window size of application interface and position.
The device that the foregoing description provides can greatly be simplified the complexity that the user develops terminal applies such as mobile phone; Solve the compatibility between multi-platform; Reduced the user and developed the general difficulty of using in terminal such as mobile phone, attracted more developer to participate in application and development, made that simultaneously the application at terminals such as mobile phone is abundanter; Enrich with the easier alternately of internet, strengthened the competitiveness of mobile phone greatly.
More than be merely preferred embodiment of the present invention,, all any modifications of within spirit of the present invention and principle, being done, be equal to and replace and improvement etc., all should be included within protection scope of the present invention not in order to restriction the present invention.