CN105893161A - Method and apparatus for calling resource in software program - Google Patents

Method and apparatus for calling resource in software program Download PDF

Info

Publication number
CN105893161A
CN105893161A CN201510927632.7A CN201510927632A CN105893161A CN 105893161 A CN105893161 A CN 105893161A CN 201510927632 A CN201510927632 A CN 201510927632A CN 105893161 A CN105893161 A CN 105893161A
Authority
CN
China
Prior art keywords
described
resource
software program
calling
characterised
Prior art date
Application number
CN201510927632.7A
Other languages
Chinese (zh)
Inventor
姚蕾
敖伟波
Original Assignee
乐视网信息技术(北京)股份有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 乐视网信息技术(北京)股份有限公司 filed Critical 乐视网信息技术(北京)股份有限公司
Priority to CN201510927632.7A priority Critical patent/CN105893161A/en
Publication of CN105893161A publication Critical patent/CN105893161A/en

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/451Execution arrangements for user interfaces
    • GPHYSICS
    • G06COMPUTING; CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/541Interprogram communication via adapters, e.g. between incompatible applications
    • GPHYSICS
    • G06COMPUTING; CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/54Indexing scheme relating to G06F9/54
    • G06F2209/543Local

Abstract

Embodiments of the invention provide a method and an apparatus for calling a resource in a software program. The method comprises the steps of in response to operation of calling the target resource in the software program, if the target resource is a local resource, calling a JS bridge connection interface; and through the JS bridge connection interface, calling the local resource and obtaining result data generated after calling the local resource. According to the technical scheme provided by the invention, the operation of calling the local system resource flexibly in the software program can be carried out.

Description

The method and apparatus calling resource in software program

Technical field

The present invention relates to the information processing technology, particularly relate to a kind of in software program, call resource Method and apparatus.

Background technology

The existing design for Webpage, in by software program development instrument such as webview When calling resource, it is common that call resource interface built-in in webview to perform preset resource Program.This shortcoming calling resource is the resource-constrained called.Such as, at existing webview In can only play video by the video label of HTML5, use is also the broadcasting of system default Device, and only support several video formats such as MP4 or OGG, poor compatibility, poor expandability.

Summary of the invention

Embodiments of the invention provide a kind of method and apparatus calling resource in software program, can Realize calling flexibly the resource operation of local system in software program.

For reaching above-mentioned purpose, The embodiment provides one in software program, call money The method in source, described method includes: in response to the operation of invocation target resource in software program, If described target resource is local resource, then call JS bridge interface;Connect by described JS Mouth calls described local resource, and obtain call described local resource after the result data that produces.

Further, described method also includes: register multiple described JS bridge in described software program Connection interface, each described JS bridge interface respectively and has call relation between corresponding local resource.

Further, described software program includes: for the page development of Android or apple system Webview application program.

Further, also wrap after the result data produced after described local resource is called in described acquisition Include: in the system page of described webview application program correspondence exploitation, show described result data.

Embodiments of the invention additionally provide a kind of device calling resource in software program, described Device includes: interface interchange module, in response to the behaviour of invocation target resource in software program Make, if described target resource is local resource, then call JS bridge interface;Resource transfer module, For calling described local resource by described JS bridge interface, and described local resource is called in acquisition The result data of rear generation.

Further, described device also includes: interface Registering modules, at described software program The multiple described JS bridge interface of middle registration, each described JS bridge interface provides with corresponding this locality respectively There is between source call relation.

Further, described software program includes: for the page development of Android or apple system Webview application program.

Further, described device also includes: result display module, at described webview The system page of application program correspondence exploitation shows described result data.

The method and apparatus calling resource in software program that the embodiment of the present invention provides, can pass through JS bridge interface is set up between software program and local resource, flexible to meet in software program Call local resource, facilitate software developer to carry out software development.

Accompanying drawing explanation

Fig. 1 provides the method flow diagram calling resource in software program for the present invention;

The logic diagram calling resource in software program that Fig. 2 provides for the present invention;

The method flow calling scanning Quick Response Code resource in software program that Fig. 3 provides for the present invention Figure;

The structure of one embodiment of device calling resource in software program that Fig. 4 provides for the present invention Block diagram;

The knot of another embodiment of device calling resource in software program that Fig. 5 provides for the present invention Structure block diagram.

Detailed description of the invention

The basic inventive concept of the present invention is, sets up JS bridge joint between software program and local resource Interface, so that call local resource flexibly in software program.

Embodiment one

The method of one embodiment of method calling resource in software program that Fig. 1 provides for the present invention Flow chart.

With reference to Fig. 1, in step S110, in response to the operation of invocation target resource in software program, If target resource is local resource, then call JS bridge interface.

The described target resource called in software program can be information resources, as being stored in appointment Data on position;Can also be the sequence of operations behavior corresponding to a certain function, and Data required in completing this function course.

In order to provide software program can call the approach of local resource, the present embodiment is in advance at software Program have registered multiple JS (Javascript) bridge interface, and each JS bridge interface is respectively With between corresponding local resource, there is call relation.As shown in table 1, for the present embodiment provides The JS bridge interface with difference in functionality.

Table 1 JS bridge interface

S120, calls local resource by JS bridge interface, and generation after local resource is called in acquisition Result data.

After there is the called startup of JS bridge interface of difference in functionality, can call according to registered in advance Relation calls local resource, and obtains corresponding result data.

The method calling resource in software program that the embodiment of the present invention provides, by software journey JS bridge interface is set up, so that calling this locality in software program flexibly between sequence and local resource Resource.

Further, above-mentioned software program comprises the steps that for Android or the page development of apple system Webview application program.

As in figure 2 it is shown, for realizing method described in this programme in android system and IOS system Principle assumption diagram.Wherein, the program development language that android system is corresponding with IOS system divides Not Wei Java and Objective-C, the corresponding software environment for WEB is embedded browser WebView and UIWebView.When WEB page performs to call resource, all pass through Webview or UIWebView loads static resource, and (static resource comprises hypertext HTML, layer Stacking style table CSS, Javascript etc.), when this static resource needs calling system API, adjust With JS bridge interface (Android:JavascriptInterface, iOS:UIWebViewDelegate), Then by finally calling local resource (Native API is local resource interface).Wherein, adjust During by JS bridge interface, directly transmit JSCallback call instruction in android system, at IOS System then needs to send URL request and completes.(android system will be processed by JS bridge interface Result is adjusted back to caller i.e. webview, and webview responds;IOS can also use JS bridge interface is called in JSCallback call instruction, except this mode, it is also possible to by application Agreement URL mode adjust back, such as: letvClient: //openvedio?Vid=215230, adjusts Video playback video id is the video of 21530).

Further, it is the page development for Android or apple system based on above-mentioned software program Webview application program.By calling JS bridge interface, obtain and produce after calling local resource Result data after, can webview application program correspondence exploitation the system page in show knot Really data.

As a example by Fig. 3, method this enforcement Suo Shi is specifically described.Fig. 3 is that the present embodiment carries The method flow diagram calling scanning Quick Response Code resource in software program of confession.

S310, carries out page loading to WEB page, and to the page loaded in software program Register multiple JS bridge interface.

S320, receives the money of the function of " identification Quick Response Code " that user clicks in WEB page Source call request.

S330, when the request of this resource transfer of software program identification is for local resource, has adjusted corresponding JS bridge interface.

S340, the JS bridge interface adjusted is according to calling between that pre-set and local resource Relation, calls local resource interface, with start local resource complete identify Quick Response Code feature operation.

S350, after local resource is called, first issues the user with and whether identifies local picture, as Really user is chosen as "Yes", then user's uploading pictures, and enters into step S370;If user It is chosen as "No", then enters into step S360.

S360, local system open system camera hardware, gather image in 2 D code.

S370, for the image currently gathering or uploading, calls identification Quick Response Code procedure identification two dimension The content of code.When system performs Quick Response Code identification, the state outcome of identification, and result is returned To JS bridge interface.

S380, represents the content of Quick Response Code in Web page.

The method calling resource in software program that the embodiment of the present invention provides, with Webview be Example, is specifically described the method calling resource in software program.This is being called by acquisition While the result data produced after ground resource, in web page, also show result data.

Embodiment two

The structure of one embodiment of device calling resource in software program that Fig. 4 provides for the present invention Block diagram.Fig. 4 shown device can be used for performing the method step of embodiment as shown in Figure 1.

With reference to Fig. 4, the device that should call resource in software program specifically includes: interface interchange mould Block 410 and resource transfer module 420, wherein:

Interface interchange module 410 is used in response to the operation of invocation target resource in software program, If target resource is local resource, then call JS bridge interface;Resource transfer module 420 is used for leading to Cross JS bridge interface and call local resource, and obtain call local resource after the result data that produces.

The device calling resource in software program that the embodiment of the present invention provides, by software journey JS bridge interface is set up, so that calling this locality in software program flexibly between sequence and local resource Resource.

Further, as it is shown in figure 5, in the above-mentioned device calling resource in software program, also Including: interface Registering modules 430, for registering multiple described JS bridge interface in software program, Each JS bridge interface respectively and has call relation between corresponding described local resource.

Further, above-mentioned software program includes: for the page development of Android or apple system Webview application program.

On this basis, Fig. 5 shown device also includes: result display module 440, be used for The system page of described webview application program correspondence exploitation shows described result data.

In this programme, as a example by Webview, the method calling resource in software program is carried out Specifically describe.While the result data produced after calling local resource by acquisition, also at web The page shows result data.

Above-mentioned the method according to the invention and device can realize in hardware, firmware, or are implemented For being storable in recording in medium (such as CD ROM, RAM, floppy disk, hard disk or magneto-optic disk) Software or computer code, or be implemented through network download original storage at long-range record In medium or nonvolatile machine readable media and the computer generation in local recording medium will be stored in Code, thus method described here can be stored in use all-purpose computer, application specific processor or At such software on the record medium of able to programme or specialized hardware (such as ASIC or FPGA) Reason.Being appreciated that computer, processor, microprocessor controller or programmable hardware include can Store or receive software or the storage assembly (such as, RAM, ROM, flash memory etc.) of computer code, When described software or computer code are by computer, processor or hardware access and execution, it is achieved Processing method described here.Additionally, when all-purpose computer accesses for realizing the place being shown in which During the code managed, all-purpose computer is converted to the process being shown in which for execution by the execution of code Special-purpose computer.

The above, the only detailed description of the invention of the present invention, but protection scope of the present invention is not Be confined to this, any those familiar with the art in the technical scope that the invention discloses, Change can be readily occurred in or replace, all should contain within protection scope of the present invention.Therefore, originally The protection domain of invention should be as the criterion with described scope of the claims.

Claims (8)

1. the method calling resource in software program, it is characterised in that described method includes:
In response to the operation of invocation target resource in software program, if described target resource is local Resource, then call JS bridge interface;
Call described local resource by described JS bridge interface, and described local resource is called in acquisition The result data of rear generation.
Method the most according to claim 1, it is characterised in that described method also includes:
Registering multiple described JS bridge interface in described software program, each described JS connects Mouth respectively and has call relation between corresponding local resource.
Method the most according to claim 1 and 2, it is characterised in that described software program package Include: for the webview application program of Android or the page development of apple system.
Method the most according to claim 3, it is characterised in that described acquisition calls described Also include after the result data produced after ground resource:
Described number of results is shown in the system page of described webview application program correspondence exploitation According to.
5. the device calling resource in software program, it is characterised in that described device includes:
Interface interchange module, is used in response to the operation of invocation target resource in software program, if Described target resource is local resource, then call JS bridge interface;
Resource transfer module, for calling described local resource by described JS bridge interface, and obtains Take the result data produced after calling described local resource.
Device the most according to claim 5, it is characterised in that described device also includes:
Interface Registering modules, for registering multiple described JS bridge interface in described software program, Each described JS bridge interface respectively and has call relation between corresponding local resource.
7. according to the device described in claim 5 or 6, it is characterised in that described software program package Include: for the webview application program of Android or the page development of apple system.
Device the most according to claim 7, it is characterised in that described device also includes:
Result display module, for the system page in the exploitation of described webview application program correspondence The described result data of middle display.
CN201510927632.7A 2015-12-14 2015-12-14 Method and apparatus for calling resource in software program CN105893161A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510927632.7A CN105893161A (en) 2015-12-14 2015-12-14 Method and apparatus for calling resource in software program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510927632.7A CN105893161A (en) 2015-12-14 2015-12-14 Method and apparatus for calling resource in software program

Publications (1)

Publication Number Publication Date
CN105893161A true CN105893161A (en) 2016-08-24

Family

ID=57002459

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510927632.7A CN105893161A (en) 2015-12-14 2015-12-14 Method and apparatus for calling resource in software program

Country Status (1)

Country Link
CN (1) CN105893161A (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106339229A (en) * 2016-08-31 2017-01-18 虎扑(上海)文化传播股份有限公司 Hybrid development method and hybrid development system for mobile platform
CN106371907A (en) * 2016-08-30 2017-02-01 乐视控股(北京)有限公司 Method and device for executing task
CN106874519A (en) * 2017-03-20 2017-06-20 百度在线网络技术(北京)有限公司 Webpage representation method and apparatus
CN107273120A (en) * 2017-06-01 2017-10-20 山东若谷信息技术有限公司 A kind of method and system of fast construction mobile phone mobile applications
CN108055570A (en) * 2017-12-20 2018-05-18 深圳市茁壮网络股份有限公司 A kind of video broadcasting method and device

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101634947A (en) * 2009-08-31 2010-01-27 腾讯科技(深圳)有限公司 IE control using local resources of client and application method thereof
EP2153324A2 (en) * 2007-05-30 2010-02-17 Google, Inc. Method and apparatus that enables a web-based client-server application to be used offline
CN102495890A (en) * 2011-12-09 2012-06-13 上海全景数字技术有限公司 Embedded browser application extension system and method
US20140207851A1 (en) * 2013-01-23 2014-07-24 Alibaba Group Holding Limited Resource calling for hybrid applications
WO2014117749A1 (en) * 2013-02-04 2014-08-07 Huawei Technologies Co., Ltd. Mechanism to initiate calls between browsers without predefined call signaling protocol

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP2153324A2 (en) * 2007-05-30 2010-02-17 Google, Inc. Method and apparatus that enables a web-based client-server application to be used offline
CN101634947A (en) * 2009-08-31 2010-01-27 腾讯科技(深圳)有限公司 IE control using local resources of client and application method thereof
CN102495890A (en) * 2011-12-09 2012-06-13 上海全景数字技术有限公司 Embedded browser application extension system and method
US20140207851A1 (en) * 2013-01-23 2014-07-24 Alibaba Group Holding Limited Resource calling for hybrid applications
WO2014117749A1 (en) * 2013-02-04 2014-08-07 Huawei Technologies Co., Ltd. Mechanism to initiate calls between browsers without predefined call signaling protocol

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106371907A (en) * 2016-08-30 2017-02-01 乐视控股(北京)有限公司 Method and device for executing task
CN106339229A (en) * 2016-08-31 2017-01-18 虎扑(上海)文化传播股份有限公司 Hybrid development method and hybrid development system for mobile platform
CN106874519A (en) * 2017-03-20 2017-06-20 百度在线网络技术(北京)有限公司 Webpage representation method and apparatus
CN107273120A (en) * 2017-06-01 2017-10-20 山东若谷信息技术有限公司 A kind of method and system of fast construction mobile phone mobile applications
CN108055570A (en) * 2017-12-20 2018-05-18 深圳市茁壮网络股份有限公司 A kind of video broadcasting method and device

Similar Documents

Publication Publication Date Title
Wargo PhoneGap essentials: Building cross-platform mobile apps
JP5845522B2 (en) Cross platform application framework
US9501458B2 (en) Executing a populated code template to generate a browser-executable software program to present a web page as a mobile application
TWI629639B (en) Method and device for realizing screen capture
US9785722B2 (en) Systems and methods for remote replay of user interaction with a webpage
US20140207851A1 (en) Resource calling for hybrid applications
CN103853548A (en) Method and system for deep links in application contexts
JP2006072517A (en) Image file management device and method, program, and storage medium
US20100211865A1 (en) Cross-browser page visualization generation
JP2008535105A (en) System and method for acquiring content based on data from an electronic device
CN104395882A (en) Creation and context-aware presentation of customized emoticon item sets
JP6336052B2 (en) Method, system, and computer program product for provisioning IT resources, and computer program
US20150278164A1 (en) Method and apparatus for constructing documents
CN104704468A (en) Cross system installation of WEB applications
CN104049986A (en) Plugin loading method and device
US9307010B2 (en) Data upload method using shortcut
US9015695B2 (en) Information processing apparatus and information processing method
US20150326933A1 (en) Video reproduction apparatus, control method thereof, and computer-readable storage medium storing program
CN103530160A (en) Page loading method and device
US9262042B2 (en) File transfer applications
CN102760131B (en) A kind of methods of exhibiting of network album and system
US20180285053A1 (en) Screenshot method and apparatus
EP2527999A1 (en) Method and apparatus for splitting media files
US9002808B1 (en) Using a web application as the default handler of local content
WO2017024852A1 (en) Information presentation method, presentation server, social application client and system

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
WD01 Invention patent application deemed withdrawn after publication
WD01 Invention patent application deemed withdrawn after publication

Application publication date: 20160824