An operating system interface call method, device, and electronic device
By using the script parsing engine in the application to compile the target file and using pre-downloaded scripts to write business logic code, the problem of inconsistent application development efficiency and user experience on different operating systems is solved, and the cross-platform call system interface is realized.
Patent Information
- Application Number
- CN202011264770.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-11-12
- Publication Date
- 2025-06-13
- Estimated Expiration
- 2040-11-12
AI Technical Summary
Due to the diversity of operating systems, it is difficult to achieve consistent user experience and development efficiency when the same application runs on different operating systems, and there are problems such as inconsistent development progress, vulnerabilities and inconsistent release time.
By detecting the application's access request, obtain the target file compiled by the script parsing engine, write business logic code using pre-downloaded scripts, and load and execute the code through the target file to call the operating system's interface to realize the application functions.
It realizes downloading a set of the same script on different types of operating systems, loading and executing the code written in the script through the script parsing engine to call the interface of any type of operating system, solving the problem of developing multiple versions of the application and improving the consistency of development efficiency and user experience.
Smart Images

Figure CN114490103B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology. Specifically, this application relates to a method and apparatus for calling an operating system interface, and an electronic device. Background Art
[0002] With the development of Internet technology, various types of application programs are widely used by people. However, due to the diversity of operating systems, such as the general existence of operating systems of types such as Android and iOS, how to make application programs applicable to multiple types of operating systems has always been a concern of people.
[0003] Currently, different versions of application programs can be developed for different types of operating systems. In this way, when the application program runs on the corresponding type of operating system, it can call the interface of the operating system to implement the functions of the application program. However, this method will inevitably result in the problem of inconsistent development progress of the same application program, thus leading to inconsistent user experiences of the same application. Summary of the Invention
[0004] The first aspect of this application provides a method for calling an operating system interface. The method includes:
[0005] When a access request for an application program is detected, obtain a target file; the target file is compiled by a script parsing engine;
[0006] Write corresponding business logic code for the access request through a pre-downloaded script;
[0007] Load and execute the business logic code through the target file to call the interface of the operating system to which the application program belongs to perform the operations indicated by the business logic code.
[0008] Optionally, obtain a target file;
[0009] Obtain a script parsing engine and determine the type of the operating system to which the application program belongs;
[0010] Based on the type of the operating system, compile the script parsing engine to obtain a target file.
[0011] Optionally, writing corresponding business logic code for the access request through a pre-downloaded script includes:
[0012] If the operating system is a first type of operating system, write corresponding business logic code for the access request through the script;
[0013] If the operating system is a second type of operating system, obtain the syntax of the operating system, and write corresponding business logic code for the access request through the script and the syntax of the operating system.
[0014] Optionally, load and execute the business logic code through the target file to call the interface of the operating system to which the application belongs to perform the operations indicated by the business logic code, including:
[0015] Load and execute the business logic code through the target file to facilitate converting the language of the business logic code into a language recognizable by the operating system;
[0016] Based on the business logic code after language conversion, call the interface of the operating system to perform the operations indicated by the business logic code.
[0017] Optionally, the method further includes:
[0018] Determine the execution result of the interface of the operating system;
[0019] Configure the data recognition rules between the script and the operating system;
[0020] Through the script, recognize the execution result based on the data recognition rules and display the recognition result on the page of the application.
[0021] Optionally, before writing the corresponding business logic code for the access request through the pre-downloaded script, the method further includes:
[0022] Download the first installation package of the application and install the application based on the first installation package; the first installation package includes an initial script;
[0023] When it is detected that the initial script has been updated, download the second installation package of the application and update the application based on the second installation package; the second installation package includes a script.
[0024] Optionally, before writing the corresponding business logic code for the access request through the pre-downloaded script, the method further includes:
[0025] When it is detected that the initial script in the application has been updated, download the script obtained by updating the initial script and store the script in the storage area accessible to the application.
[0026] The second aspect of the present application provides an operating system interface calling device, and the device includes:
[0027] An acquisition module, configured to acquire a target file when detecting an access request for an application; the target file is compiled by a script parsing engine;
[0028] A logic code writing module, configured to write the corresponding business logic code for the access request through the pre-downloaded script;
[0029] A logic code execution module, which is used to load and execute business logic code through a target file, so as to call the interface of the operating system to which the application belongs to execute the operations indicated by the business logic code.
[0030] Optionally, an acquisition module, specifically used for:
[0031] Acquire a script parsing engine and determine the type of the operating system to which the application belongs;
[0032] Based on the type of the operating system, compile the script parsing engine to obtain a target file.
[0033] Optionally, a logic code writing module, specifically used for:
[0034] If the operating system is the first type of operating system, write corresponding business logic code for the access request through a script;
[0035] If the operating system is the second type of operating system, obtain the syntax of the operating system, and write corresponding business logic code for the access request through the script and the syntax of the operating system.
[0036] Optionally, a logic code execution module, specifically used for:
[0037] Load and execute the business logic code through the target file, so as to convert the language of the business logic code into a language recognizable by the operating system;
[0038] Based on the business logic code after language conversion, call the interface of the operating system to execute the operations indicated by the business logic code.
[0039] Optionally, the device further includes:
[0040] A determination module, which is used to determine the execution result of the interface of the operating system;
[0041] A configuration module, which is used to configure the data recognition rule between the script and the operating system;
[0042] An identification module, which is used to identify the execution result through the script based on the data recognition rule, and display the identification result on the page of the application.
[0043] Optionally, the device further includes a first download module and a second download module;
[0044] Before the logic code writing module writes corresponding business logic code for the access request through a pre-downloaded script;
[0045] The first download module is used to download the first installation package of the application and install the application based on the first installation package; the first installation package includes an initial script;
[0046] A second download module, configured to download a second installation package of the application when it detects that the initial script has been updated, and update the application based on the second installation package; the second installation package includes the script.
[0047] Optionally, the apparatus further includes a third download module, before the logic code writing module writes corresponding service logic code for an access request through the pre-downloaded script;
[0048] The third download module is configured to download the script obtained by updating the initial script when it detects that the initial script in the application has been updated, and store the script in a storage area accessible by the application.
[0049] The beneficial effects of this application are as follows:
[0050] This application can obtain a script parsing engine and compile the script parsing engine into a target file. In this way, for the access requests of users on the application, after writing corresponding service logic code through the script, the service logic code can be loaded and executed through the target file, and the interface of the operating system can be called to execute the operations indicated by the service logic code, thereby the functions of the application can be realized. It can be seen that this application can download a set of the same scripts on different types of operating systems, and can load and execute the code written by the script through the script parsing engine to call the interfaces of any type of operating system to realize the functions of the application, without the need to pay attention to the differences between operating systems, thus eliminating the need to develop multiple versions of the application, improving the development efficiency, avoiding the problem of inconsistent development progress of the application, and ensuring the consistency of user experience, program vulnerabilities, and release time. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] In order to more clearly illustrate the technical solutions in the embodiments of this application, the following will briefly introduce the drawings required for the description of the embodiments of this application.
[0052] Figure 1 It is a schematic flowchart of the operating system interface call method of this application;
[0053] Figure 2 It is a schematic diagram of an embodiment of the operating system interface call method of this application;
[0054] Figure 3 It is a possible situation of downloading a script in this disclosure;
[0055] Figure 4 It is another possible situation of downloading a script in this disclosure;
[0056] Figure 5 It is a schematic structural diagram of the operating system interface call apparatus of this disclosure;
[0057] Figure 6 This is a schematic structural diagram of the electronic device disclosed in the present disclosure. Detailed implementation manners
[0058] Embodiments of the present application will be described in detail below. Examples of the embodiments are shown in the accompanying drawings, in which the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below by referring to the drawings are exemplary and are only used to explain the present application and should not be construed as a limitation to the present invention.
[0059] Those skilled in the art of the present technology can understand that, unless specifically stated otherwise, the singular forms "a", "an", "the" and "said" used herein may also include the plural forms. It should be further understood that the term "including" used in the specification of the present application means the presence of features, integers, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or their groups. It should be understood that when we say that an element is "connected" or "coupled" to another element, it can be directly connected or coupled to other elements, or there may also be intermediate elements. In addition, the "connection" or "coupling" used herein may include wireless connection or wireless coupling. The phrase "and / or" used herein includes all or any unit and all combinations of one or more related listed items.
[0060] To make the objectives, technical solutions and advantages of the present application clearer, the embodiments of the present application will be further described in detail below with reference to the accompanying drawings.
[0061] When various common application programs run on an operating system, they need to call the interfaces of the operating system to implement the functions of the application programs. Since there are various types of operating systems, in order to match various types of operating systems, the same application program often needs to be developed in multiple versions. For example, it is necessary to develop two versions for Android and iOS. Users can download and install different versions of the application program according to the type of the operating system of their own devices during use. It can be seen that in the existing solutions, the same application program needs to be developed in multiple versions, and the development cost is very high. At the same time, there will be a problem that the development progress of the application program is inconsistent, which will lead to inconsistencies in the bugs, user experience, and release time points of the application program.
[0062] To solve the above technical problems, the present application provides a method for calling an operating system interface. First, several terms involved in the present application are explained:
[0063] The lua script parsing engine is written in standard C language and is open in source code form. After compilation, it is only more than one hundred kilobytes and can be easily embedded in the application program, thereby providing flexible extension and customization functions for the application program.
[0064] The Lua script is a scripting language, and the Lua script parsing engine can call the Lua script to implement the functions of the application program.
[0065] Refer to Figure 1 , the method of this application can be executed by the terminal device or by the application program on the terminal device. The method of this application includes:
[0066] Step S101: When a access request for the application program is detected, obtain the target file; the target file is compiled by the script parsing engine;
[0067] When the terminal device detects a access request for any application program installed on the terminal device, the terminal device can obtain the target file.
[0068] In this embodiment, the access request can be a request to access the web page of the application program, or a request to run a certain function of the application program, and specific limitations are not made here.
[0069] In this embodiment, a script parsing engine is installed on the terminal device. The script parsing engine can be a Lua script parsing engine, and the script parsing engine can be a functional module or a functional component. The target file is compiled by the script parsing engine installed on the terminal device, and the role of the target file is to load and execute the business logic code written by the script.
[0070] Step S102: Write the corresponding business logic code for the access request through the pre-downloaded script;
[0071] The terminal device can write the corresponding business logic code for the access request through the pre-downloaded script (i.e., the scripting language). The business logic code is actually the code written to implement the functions of the application program requested by the access request. This script can be a Lua script.
[0072] The pre-downloaded Lua script is stored in the storage area accessible to the application program, so that the Lua script can be called to write the business logic code for the access request of this application program.
[0073] After the terminal device writes the business logic code, the business logic code can be stored in the form of a file.
[0074] Step S103: Load and execute the business logic code through the target file to call the interface of the operating system to which the application program belongs to execute the operations indicated by the business logic code.
[0075] Based on the target file, the terminal device can load the business logic code into a specified area in the device. For example, the written business logic code is initially stored in the business logic layer of the terminal device, and this business logic code can be loaded into the engine layer of the terminal device. The lua script parsing engine is located in the engine layer, so that the business logic code can be executed through the target file compiled by the lua script parsing engine.
[0076] By executing the business logic code, the lua script parsing engine can call the interfaces of the operating system to which the application belongs (i.e., the operating system to which the terminal device belongs) to perform the operations indicated by the business logic code, so as to implement the logic and effects of the business logic code.
[0077] It can be seen that this application can obtain the script parsing engine and compile the script parsing engine into a target file. In this way, for the access requests of users on the application, after writing the corresponding business logic code through the script, the business logic code can be loaded and executed through the target file, and the interfaces of the operating system can be called to perform the operations indicated by the business logic code, so that the functions of the application can be realized. It can be seen that this application can download a set of the same scripts on different types of operating systems, and can load and execute the code written by the script through the script parsing engine to call the interfaces of any type of operating system to realize the functions of the application, without having to pay attention to the differences between operating systems, so there is no need to develop multiple versions of the application, which improves the development efficiency, avoids the problem of inconsistent development progress of the application, and ensures the consistency of user experience, program vulnerabilities and release time.
[0078] It can be seen that this application realizes the feature of cross-platform calling of system interfaces.
[0079] At the same time, the script of this application is downloaded to the local storage area of the application, and is loaded and executed by the script parsing engine installed on the terminal device to call the system interface, and the execution efficiency is relatively high, which can reach the same level as that of native applications.
[0080] Optionally, there are the following two possible situations for obtaining the target file in the above step S101:
[0081] Situation 1: Each time an access request for the application is detected, the script parsing engine is compiled into a target file;
[0082] The above step S101 specifically includes: obtaining the script parsing engine and determining the type of the operating system to which the application belongs; based on the type of the operating system, compiling the script parsing engine to obtain a target file.
[0083] The terminal device obtains a script parsing engine and compiles the C-language version of the script parsing engine into a target file that can be called by the operating system based on the type of the operating system. Specifically, the terminal device obtaining the script parsing engine includes: when the terminal device receives an access request, it downloads and installs the script parsing engine from the server, or if the terminal device has pre-installed the script parsing engine, when the terminal device receives an access request, it determines the pre-installed script parsing engine.
[0084] Case 2: Before detecting an access request for an application, the script parsing engine has been compiled into a target file.
[0085] The terminal device pre-compiles the script parsing engine into a target file in advance, so that when the terminal device detects an access request for an application, it can directly obtain the compiled target file. Similarly, the terminal device compiles the script parsing engine into a target file that can be used by the operating system based on the type of the operating system.
[0086] For the above Case 1 or Case 2, for different types of operating systems, the situations of the compiled target files are as follows:
[0087] If the operating system is a first-type operating system, such as the iOS system, since the programs of the iOS system are developed using the Objective-C language, which is essentially an evolution of the C language, its call to the C language itself is simpler and more convenient. Only according to the requirements of the Objective-C language, the source code of the C-language version of the lua script parsing engine is compiled to obtain a static library file (.a file), so that the terminal device under the first-type operating system can call the.a file to load and execute the business logic code.
[0088] If the operating system is a second-type operating system, such as the Android system, and the Android system uses the Java language, the script parsing engine can be compiled into a dynamic library file (.so file), so that the terminal device under the second-type operating system can call the.so file to load and execute the business logic code;
[0089] Optionally, step S102 writes corresponding business logic code for the access request through a pre-downloaded script, including:
[0090] If the operating system is a first-type operating system, corresponding business logic code for the access request is written through the script.
[0091] If the operating system is a second-type operating system, the syntax of the operating system is obtained, and corresponding business logic code for the access request is written through the script and the syntax of the operating system.
[0092] In this embodiment, for different types of operating systems, business logic code can be written based on different languages. Specifically:
[0093] If the operating system is a first type of operating system, such as the iOS system, since the development language used by iOS system programs is essentially an evolution of the C language and can be called with the Lua scripting language, corresponding business logic code can be written directly through the scripting language of the script for access requests.
[0094] If the operating system is a second type of operating system, such as the Android system, and the language used by the Android system is not the C language, then the syntax of the commonly used application programming interface (API) in the Android system can be obtained and injected into the Lua script parsing engine. In this way, the Lua script parsing engine can also call the API logic, thereby expanding the syntax that can be used when writing business logic code with the Lua script. For example:
[0095] The terminal device can obtain the API syntax and write corresponding business logic code for access requests through the scripting language of the script in combination with the API syntax. The Lua script parsing engine can parse this business logic code.
[0096] It can be seen that this application can provide the syntax extension ability of the Lua script. During the application development process, terminal devices often need to expand different capabilities according to requirements to meet more business scenarios. For teams with the ability to customize and develop terminal devices, the API syntax can be extended according to standard specifications and injected into the Lua script parsing engine, thereby expanding the syntax that can be used when writing code with the Lua script.
[0097] Optionally, step S103 loads and executes the business logic code through the target file to call the interface of the operating system to which the application belongs to perform the operations indicated by the business logic code, including:
[0098] Load and execute the business logic code through the target file to facilitate converting the language of the business logic code into a language recognizable by the operating system;
[0099] Based on the business logic code after language conversion, call the interface of the operating system to perform the operations indicated by the business logic code.
[0100] In existing solutions, since different types of operating systems use different development languages, applications running on a certain operating system also need to be developed using a language adapted to the development language of the operating system. Thus, multiple versions of the same application need to be developed. However, in the solution of this application, an application can call the interfaces of any type of operating system through lua scripts to implement the functions of the application. For multiple types of operating systems, only one set of applications needs to be developed. The principle is as follows:
[0101] The terminal device can install a lua script parsing engine and download lua scripts. When a request to run a certain function of the application is detected, the terminal device can compile the lua script parsing engine into a target file. At the same time, business logic code for this request is written through lua scripts. The target file can load and execute this business logic code, thus converting the language of the business logic code into a language that the operating system can recognize. For example, the language of the business logic code is converted into binary language. In this way, the terminal device can call the interfaces of the operating system based on the business logic code after language conversion to execute the operations indicated by this business logic code.
[0102] It can be seen that for operating systems using different languages, this application only needs to download one set of the same lua scripts. After installing the lua script parsing engine, the code written by lua scripts can be driven by the lua script parsing engine. After converting the language of this code into binary language, the interfaces of any type of operating system can be called to achieve the feature of cross-platform calling of system interfaces.
[0103] A possible application scenario of this application is as follows: Figure 2 , there is a lua script downloaded in the application (APP). When any function of the application needs to be implemented, business logic code can be written through lua scripts and loaded into the lua script parsing engine at the engine layer. Whether it is for the Android system based on Java programs or the iOS system based on Objective-C programs, the lua script parsing engine can parse the business logic code into code in binary language, so that the native logic layer can recognize this code in binary language to call system interfaces to access the hardware layer and implement the functions of the application.
[0104] Furthermore, this application can also configure the data recognition rules (or data exchange rules) between the lua script and the operating system to facilitate the transfer of parameters between the lua script and the operating system.
[0105] A possible situation where parameter passing is required is as follows: Before the terminal device loads and executes the business logic code through the target file to call the operating system interface, the terminal device needs to send instruction parameters to the operating system through the lua script. Since the lua scripting language is not compatible with the languages used by the operating system (Java for Android and Objective-C for iOS), it is necessary to transfer the instruction parameters between the lua script and the operating system based on the pre-configured data recognition rules.
[0106] Another possible situation where parameter passing is required is as follows: After the operation indicated by the business logic code is executed by calling the operating system interface, the execution result of the business logic code also needs to be passed back to the lua script through the operating system. Then, the lua script of the terminal device can recognize the execution result based on this data recognition rule, so that the lua script can display the recognition result on the application page for the user to view.
[0107] Optionally, there are at least two implementable ways for the terminal device of the present application to download the lua script:
[0108] One implementable way A is: Before writing the corresponding business logic code for the access request through the pre-downloaded script, this method further includes:
[0109] Download the first installation package of the application and install the application based on the first installation package; the first installation package includes the initial script;
[0110] When it is detected that the initial script is updated, download the second installation package of the application and update the application based on the second installation package; the second installation package includes the script.
[0111] If the lua script is included in the program installation package (Android application package, APK) of the application, the terminal device can download the first installation package of the application from the server and install the application based on the first installation package. The first installation package includes the initial script, so that the initial script can be embedded in the application;
[0112] If the terminal device detects that the initial script is updated, the terminal device can re-download the second installation package of the application from the server. The second installation package includes the script mentioned in the present application updated from the initial script. The terminal device can update the application based on the second installation package, and the updated application embeds the script, so that the application function can be realized through the script.
[0113] Another implementable way B is as follows: The Lua script is not included in the APK of the application. The Lua script can be stored in a specific storage area of the server or a cloud database. In this case, the addition, deletion, and modification of the Lua script can be achieved without updating the application. Specifically:
[0114] The terminal device can download the installation package of the application from the server and install the application based on the installation package. The installation package includes an initial script. If the terminal device detects that the initial script has been updated, it can download the script mentioned in this application obtained by updating the initial script from a specific storage area of the server, so as to store the script in a storage area accessible to the application, and thus the application function can be implemented through the script.
[0115] It can be seen that, compared with way A, way B can update the Lua script without updating the application, avoiding the problems of network resource consumption and cumbersome operations caused by frequent downloading and installation of the application, making the operating system interface call method of this application applicable to more scenarios.
[0116] In the case of adding a Lua script to the application: After the terminal device downloads and installs the application, it can download the Lua script from a specific storage area of the server and store it in a storage area accessible to the terminal device.
[0117] In the case of deleting a Lua script from the application: The terminal device can delete the Lua script in the storage area accessible to the application, which can save storage resources.
[0118] As Figure 3 shown, one way to download the script is to directly download the installation package of the application from the server. The installation package includes the script. In this case, when the script is added, modified, or deleted, the installation package of the application needs to be redownloaded to update the application; as Figure 4 shown, another way to download the script is to download the installation package of the application from the server and download the script from the cloud database. In this case, when the script is updated, deleted, or added, the application does not need to be updated.
[0119] Optionally, this application can also encapsulate and improve the common methods of the Lua script to form some tool classes and methods, making the process of writing business logic code with the Lua script more concise.
[0120] Please refer to Figure 5 , the second aspect of this application provides an operating system interface call device, and the method includes:
[0121] An acquisition module 501, configured to acquire a target file when detecting an access request for an application; the target file is compiled by a script parsing engine;
[0122] A logic code writing module 502, configured to write corresponding service logic code for an access request by means of a pre-downloaded script.
[0123] A logic code execution module 503, configured to load and execute the service logic code by means of a target file, so as to call an interface of an operating system to which the application belongs to execute an operation indicated by the service logic code.
[0124] Optionally, an obtaining module 501 is specifically configured to:
[0125] Obtain a script parsing engine and determine the type of the operating system to which the application belongs;
[0126] Compile the script parsing engine based on the type of the operating system to obtain a target file.
[0127] Optionally, the logic code writing module 502 is specifically configured to:
[0128] If the operating system is a first type of operating system, write corresponding service logic code for the access request by means of the script;
[0129] If the operating system is a second type of operating system, obtain the syntax of the operating system, and write corresponding service logic code for the access request by means of the script and the syntax of the operating system.
[0130] Optionally, the logic code execution module 503 is specifically configured to:
[0131] Load and execute the service logic code by means of the target file, so as to convert the language of the service logic code into a language recognizable by the operating system;
[0132] Based on the service logic code after language conversion, call an interface of the operating system to execute an operation indicated by the service logic code.
[0133] Optionally, the apparatus further includes:
[0134] A determination module, configured to determine an execution result of an interface of the operating system;
[0135] A configuration module, configured to configure a data recognition rule between the script and the operating system;
[0136] An identification module, configured to identify an execution result by means of the script based on the data recognition rule, and display the identification result on a page of the application.
[0137] Optionally, the apparatus further includes a first download module and a second download module;
[0138] Before the logic code writing module 502 writes corresponding business logic code for an access request through a pre-downloaded script;
[0139] A first download module, configured to download a first installation package of an application and install the application based on the first installation package; the first installation package includes an initial script;
[0140] A second download module, configured to download a second installation package of the application and update the application based on the second installation package when it detects that the initial script has been updated; the second installation package includes a script.
[0141] Optionally, the device further includes a third download module, before the logic code writing module 502 writes corresponding business logic code for an access request through a pre-downloaded script;
[0142] The third download module is configured to download a script obtained by updating the initial script when it detects that the initial script in the application has been updated, and store the script in a storage area accessible to the application.
[0143] Since the device provided in the embodiments of the present invention is a device that can execute the corresponding method in the embodiments of the present invention, based on the method provided in the embodiments of the present invention, those skilled in the art can understand the specific implementation manners and various variations of the device in the embodiments of the present invention. Therefore, the implementation of how the device realizes the method in the embodiments of the present invention will not be described in detail here. As long as the device used by those skilled in the art to implement the method in the embodiments of the present invention falls within the scope of protection of this application.
[0144] Based on the same principle as the Figure 1 method shown in, an embodiment of the present application further provides an electronic device, which includes a memory and a processor; a computer program is stored in the memory; the processor is configured to execute the method provided in any optional embodiment of the present application when running the computer program.
[0145] An embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored, and when the program is executed by a processor, it can implement the method provided in any optional embodiment of the present application.
[0146] As an example, Figure 6 a schematic structural diagram of an electronic device 4000 to which the present application can be applied is shown in, the electronic device includes a memory 4003 and a processor 4001, a computer program is stored in the memory 4003, and the processor 4001 is configured to execute any of the above methods when running the computer program.
[0147] Specifically, the electronic device can be a terminal, a server or other possible devices,Figure 6 Only an optional schematic structure of the electronic device is shown. Figure 6 The structure of the electronic device 4000 shown therein does not constitute a limitation on the embodiments of the present application.
[0148] Among them, the processor 4001 and the memory 4003 are connected, such as being connected through the bus 4002. Optionally, the electronic device 4000 may further include a transceiver 4004. It should be noted that in practical applications, the transceiver 4004 is not limited to one, and the transceiver 4004 can be specifically used for the communication between the electronic device 4000 and other devices.
[0149] The processor 4001 may be a CPU (Central Processing Unit), a general-purpose processor, a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array), or other programmable logic devices, transistor logic devices, hardware components, or any combination thereof. It can implement or execute various exemplary logical blocks, modules, and circuits described in connection with the content of the present application. The processor 4001 may also be a combination that realizes computing functions, such as a combination including one or more microprocessors, a combination of a DSP and a microprocessor, etc.
[0150] The bus 4002 may include a path for transmitting information between the above components. The bus 4002 may be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus, etc. The bus 4002 may be divided into an address bus, a data bus, a control bus, etc. For the sake of representation, Figure 6 only a thick line is used to represent it in the figure, but it does not mean that there is only one bus or one type of bus.
[0151] The memory 4003 can be a ROM (Read Only Memory), or other types of static storage devices that can store static information and instructions, a RAM (Random Access Memory), or other types of dynamic storage devices that can store information and instructions. It can also be an EEPROM (Electrically Erasable Programmable Read Only Memory), a CD-ROM (Compact Disc Read Only Memory), or other optical disc storage, optical disc storage (including compact discs, laser discs, optical discs, digital versatile discs, Blu-ray discs, etc.), magnetic disk storage media, or other magnetic storage devices, or any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto.
[0152] The memory 4003 is used to store the application program code for executing the solution of this application, and is controlled by the processor 4001 for execution. The processor 4001 is used to execute the application program code stored in the memory 4003 to implement the content shown in any of the above method embodiments.
[0153] It should be understood that although the steps in the flowchart of the accompanying drawings are shown in sequence according to the indication of the arrows, these steps do not necessarily have to be executed in the order indicated by the arrows. Unless there is a clear indication in this article, the execution of these steps has no strict order limit, and they can be executed in other orders. Moreover, at least a part of the steps in the flowchart of the accompanying drawings may include multiple sub-steps or multiple stages. These sub-steps or stages do not necessarily have to be executed at the same time, but can be executed at different times. Their execution order does not necessarily have to be sequential, but can be executed alternately or in turn with at least a part of other steps or sub-steps or stages of other steps.
[0154] The above are only partial embodiments of the present invention. It should be noted that for those of ordinary skill in the art in this technical field, without departing from the principle of the present invention, several improvements and refinements can be made, and these improvements and refinements should also be regarded as the protection scope of the present invention.
Claims
1. A method for invoking an operating system interface, characterized in that, it includes: When a access request for an application is detected, obtain a target file; The target file is obtained by compiling a script parsing engine; Write corresponding business logic code for the access request through a pre-downloaded script; Load and execute the business logic code through the target file to invoke the interface of the operating system to which the application belongs to execute the operation indicated by the business logic code; Wherein, the obtaining of the target file includes: Obtain a script parsing engine and determine the type of the operating system to which the application belongs; Based on the type of the operating system, compile the script parsing engine to obtain the target file.
2. The method according to claim 1, characterized in that, The writing of corresponding business logic code for the access request through a pre-downloaded script includes: If the operating system is a first type of operating system, write corresponding business logic code for the access request through the script; If the operating system is a second type of operating system, obtain the syntax of the operating system, and write corresponding business logic code for the access request through the script and the syntax of the operating system.
3. The method according to claim 1, characterized in that, The loading and executing of the business logic code through the target file to invoke the interface of the operating system to which the application belongs to execute the operation indicated by the business logic code includes: Load and execute the business logic code through the target file to facilitate converting the language of the business logic code into a language recognizable by the operating system; Based on the business logic code after language conversion, invoke the interface of the operating system to execute the operation indicated by the business logic code.
4. The method according to claim 1, characterized in that, The method further includes: Determine the execution result of the interface of the operating system; Configure the data recognition rule between the script and the operating system; Recognize the execution result based on the data recognition rule through the script and display the recognition result on the page of the application.
5. The method according to claim 1, characterized in that, Before writing corresponding business logic code for the access request through a pre-downloaded script, the method further includes: Download the first installation package of the application and install the application based on the first installation package; the first installation package includes an initial script; When it is detected that the initial script is updated, download the second installation package of the application and update the application based on the second installation package; the second installation package includes the script.
6. The method according to claim 1, characterized in that, Before writing corresponding business logic code for the access request through a pre-downloaded script, the method further includes: When it is detected that the initial script in the application is updated, download the script updated from the initial script and store the script in a storage area accessible to the application.
7. An operating system interface call device, characterized in that, comprising: an acquisition module, configured to acquire a target file when detecting an access request for an application; the target file is obtained by compiling a script parsing engine; a logic code writing module, configured to write corresponding business logic code for the access request through a pre-downloaded script; a logic code execution module, configured to load and execute the business logic code through the target file to call an interface of the operating system to which the application belongs to execute an operation indicated by the business logic code; wherein, acquiring the target file includes: acquiring a script parsing engine and determining the type of the operating system to which the application belongs; compiling the script parsing engine based on the type of the operating system to obtain the target file.
8. An electronic device, characterized in that, the electronic device includes a memory and a processor; a computer program is stored in the memory; the processor is configured to execute the method according to any one of claims 1-6 when running the computer program.
9. A computer-readable storage medium, characterized in that, a computer program is stored on the storage medium, and when the program is executed by a processor, the method according to any one of claims 1-6 is implemented.
Citation Information
Patent Citations
Cross-platform mobile application implementation method and cross-platform mobile application implementation system
CN104636147A