Local function execution method and device, storage medium and electronic equipment
The function execution request of the toolkit generation function is controlled to control the function of calling the terminal device in the native layer, which solves the problem of application development relying on the system framework in the prior art, and improves development convenience and adaptability.
Patent Information
- Application Number
- CN202311508870.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-13
- Publication Date
- 2025-05-13
AI Technical Summary
In the prior art, application development relies too much on the system framework of terminal equipment, which leads to high development difficulties, high human resources consumption, and it is difficult for applications to adapt to different application scenarios.
The function of calling the toolkit generation function execution request is controlled to control the function of calling the terminal device in the native layer, so that the application front-end does not need to use the same system framework as the native layer to realize the functions of communicating and using the terminal device.
It improves the convenience of application development, reduces development difficulty, and improves the application's adaptability to different scenarios.
Smart Images

Figure CN119988050A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a local function execution method, device, storage medium and electronic device. Background Art
[0002] In the prior art, if one wants to develop applications and other projects on a terminal device, one needs to use the system framework corresponding to the terminal device, such as the Android system framework, because the application often needs to use the local functions of the terminal device or call the local information of the terminal device during operation. Only by using the same system framework to build the application can communication with the terminal device be achieved, thereby calling the local functions of the terminal device or obtaining local information. The application development in the prior art is too dependent on the system framework of the terminal device, resulting in excessive human resources and time consumption required for application development, and the developed application is difficult to adapt to different application scenarios. It is necessary to provide a flexible and easy-to-develop method for applications to execute local functions of terminal devices. Summary of the invention
[0003] The embodiments of the present application provide a local function execution method, device, storage medium and electronic device, which can control the native layer to call the function of the terminal device by calling the toolkit to generate a function execution request, so that the application front end does not need to use the same system framework as the native layer to achieve communication and use the functions of the terminal device, improve the convenience of application development, reduce the difficulty of application development, and improve the adaptability of the application to different scenarios. The technical solution is as follows:
[0004] In a first aspect, an embodiment of the present application provides a local function execution method, which is applied to an application of a terminal device, wherein the application includes an application front end, a function call toolkit, and a native layer, and the method includes:
[0005] Receiving an execution instruction for a target function in the terminal device based on the application front end;
[0006] generating a function execution request for the target function based on the function call toolkit;
[0007] The function call toolkit is controlled to send the function execution request to the native layer, and the native layer is controlled to implement the target function based on the function execution request.
[0008] In a second aspect, an embodiment of the present application provides a local function execution device, which is applied to an application of a terminal device, wherein the application includes an application front end, a function call toolkit, and a native layer, and the device includes:
[0009] Receiving an execution instruction for a target function in the terminal device based on the application front end;
[0010] generating a function execution request for the target function based on the function call toolkit;
[0011] The function call toolkit is controlled to send the function execution request to the native layer, and the native layer is controlled to implement the target function based on the function execution request.
[0012] In a third aspect, an embodiment of the present application provides a computer storage medium, wherein the computer storage medium stores a plurality of instructions, wherein the instructions are suitable for being loaded by a processor and executing the above-mentioned method steps.
[0013] In a fourth aspect, an embodiment of the present application provides an electronic device, which may include: a processor and a memory; wherein the memory stores a computer program, and the computer program is suitable for being loaded by the processor and executing the above-mentioned method steps.
[0014] In one or more embodiments of the present application, the application front end receives an execution instruction for a target function in the terminal device, generates a function execution request for the target function based on the function call toolkit, controls the function call toolkit to send the function execution request to the native layer, and controls the native layer to implement the target function based on the function execution request. By calling the toolkit to generate a function execution request to control the native layer to call the function of the terminal device, the application front end does not need to use the same system framework as the native layer to realize communication and use the functions of the terminal device, which improves the convenience of application development, reduces the difficulty of application development, and improves the adaptability of the application to different scenarios. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0016] Figure 1 This is an example schematic diagram of an application program running provided in an embodiment of the present application;
[0017] Figure 2 It is a flowchart of a local function execution method provided in an embodiment of the present application;
[0018] Figure 3 It is a flowchart of a local function execution method provided in an embodiment of the present application;
[0019] Figure 4 This is an example schematic diagram of an implementation of a target function provided by an embodiment of the present application;
[0020] Figure 5 is a structural diagram of a local function execution device provided in an embodiment of the present application;
[0021] Figure 6 is a structural diagram of a local function execution device provided in an embodiment of the present application;
[0022] Figure 7 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0023] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0024] The local function execution device is applied to the application of the terminal device. The local function execution device can be an application or a module in the application for implementing the local function execution method. The local function execution method provided in the embodiment of the present application can be implemented by a computer program and can be run on a local function execution device based on the von Neumann system. The computer program can be integrated in the application or run as an independent tool application. The terminal device can be a mobile phone, a tablet computer, a wearable device, and a vehicle-mounted device, a vehicle, and other devices that can have an application. Applications can help users use local functions of terminal devices, obtain local information of terminal devices, and even help users call third-party applications in terminal devices. Local functions can be native functions of terminal devices, i.e. built-in functions based on the hardware or native system contained in the terminal devices, such as speakers, cameras, acceleration sensors, etc. of terminal devices. If the terminal device is a vehicle or vehicle-mounted device, local functions can also include turning on or off lights, turning on or off horns, etc. Similarly, local information is relevant information about the hardware or native system of the terminal device, such as the Global Positioning System (GPS) information of the terminal device, device memory usage, etc. If the terminal device is a vehicle or vehicle-mounted device, local information can also include fuel consumption, current driving speed, etc. Third-party applications are other applications in terminal devices except applications.
[0025] Please also see Figure 1 , provides an example schematic diagram of the operation of an application program for the embodiment of the present application, and the application program may include an application front end, a function call toolkit, and a native layer. The application front end and the function call toolkit may communicate with each other, and the function call toolkit and the native layer may communicate with each other. The application front end is the front end part of the application program, for example, it may be a World Wide Web (Web) end, a browser end, etc., and an interface may be displayed on the display screen of the terminal device for users to browse, and the services corresponding to the application program may be accessed and used through the Web. It is understandable that the interface displayed by the application front end may be a browser interface, a web page interface, an HTML5 web page interface, etc. The application front end may display buttons or prompt information for calling local functions of the terminal device, obtaining local information, etc. on the interface, and the user may send an execution instruction for the target function of the terminal device to the application front end through the display interface of the application front end. The target function may be to execute a certain local function, to obtain certain local information, or to call a certain third-party application program. The execution instruction is used to instruct the application program to implement the target function. The execution instruction may be generated based on the user's click operation on the button or prompt information on the display interface, or may be generated based on the user's voice.
[0026] The native layer can be a Native layer. The native layer is developed based on the native system framework of the terminal device. For example, it can be developed based on the Android system framework and is used to interact with the underlying hardware driver of the terminal device. The native layer developed based on the native system framework can realize the application's call of local functions of the terminal device and the acquisition of local information. For example, the native layer can call local functions or obtain local information through the system interface (System API). The application front end does not need to be developed based on the native system framework. For example, the native layer can be developed based on the Android system framework, and the application front end does not need to be developed based on the Android system framework. In order to enable the execution instructions received by the application front end to be transmitted to the native layer, so that the native layer can realize the target function expected by the user, the local function execution device can use a function call toolkit to realize data interaction between the application front end and the native layer. The function call toolkit can be a software development kit (SDK). The application front end can send execution instructions to the function call toolkit. The function call toolkit generates a function execution request based on the execution instruction. The function execution request is used to request the native layer to implement the target function targeted by the execution instruction. The function call toolkit then sends the function execution request to the native layer. The native layer can access the system interface according to the function execution request to implement the target function expected by the user.
[0027] Among them, the data communication between the application front end and the function call toolkit can be achieved through the Javascript Bridge, that is, the application front end can send the execution instruction to the Javascript Bridge, and then the Javascript Bridge sends the execution instruction to the function call toolkit. The Javascript Bridge can build a two-way channel for message communication between Native and non-Native. The data between the function call toolkit and the native layer can be realized based on the communication interface provided by the native system framework. For example, if the native layer can be developed based on the Android system framework, the data communication between the function call toolkit and the native layer can be realized through the communication interface provided by the Android system framework. In this way, data interaction between the application front end and the native layer under different system frameworks can be realized based on the function call toolkit, thereby realizing the call of local functions of the terminal device and the acquisition of local information.
[0028] The local function execution method provided by the present application is described in detail below in conjunction with specific embodiments.
[0029] See also Figure 2 , which is a flowchart of a local function execution method provided in an embodiment of the present application. Figure 2 As shown, the method of the embodiment of the present application may include the following steps S101-S103.
[0030] S101, receiving an execution instruction for a target function in a terminal device based on an application front end.
[0031] Specifically, the local function execution device can control the application front end to display the display interface of the application on the display screen of the terminal device. Since the application can help users call the local functions of the terminal device, obtain the local information of the terminal device, etc., the display interface displays the buttons or prompt information corresponding to the local functions and local information of the terminal device, and the user inputs the execution instruction for the target function according to the buttons or prompt information on the display interface. Among them, the target function can be to call the local function of the terminal device, or to obtain the local information of the terminal device, etc. The execution instruction can be generated based on the user's click operation on the button or prompt information, or it can be generated based on the user's voice information. The local function execution device can receive the user's execution instruction for the target function in the terminal device based on the application front end, so as to realize the target function expected by the user according to the execution instruction.
[0032] For example, if the terminal device is a vehicle or an in-vehicle device, the application front end can display the interface of the application on the display interface of the in-vehicle device for the user to browse. Since the application can help the user call the local functions of the terminal device, obtain local information, etc., the application front end can display a button such as "Turn on the interior ceiling light" on the interface. If the user wants to turn on the ceiling light, he can click the "Turn on the interior ceiling light" button on the interface displayed by the application front end. This is equivalent to the application front end receiving an execution instruction for the interior ceiling light, and the local function execution device can turn on the interior ceiling light of the vehicle according to the execution instruction.
[0033] S102: Generate a function execution request for a target function based on a function call toolkit.
[0034] Specifically, the local function execution device can control the application front end to send the received execution instruction to the function call toolkit, and then generate a function execution request for the target function based on the function call toolkit. Since the native layer can be developed based on the native system framework of the terminal device, it can be used to interact with the underlying hardware driver of the terminal device. The function execution request is used to request the native layer to implement the target function targeted by the execution instruction.
[0035] S103, controlling the function calling toolkit to send the function execution request to the native layer, and controlling the native layer to implement the target function based on the function execution request.
[0036] Specifically, after the function call toolkit generates a function execution request, the local function execution device can control the function call toolkit to send the function execution request to the native layer, and then control the native layer to implement the target function based on the function execution request. For example, the native layer can be controlled to call the terminal device interface corresponding to the target function to implement the target function, where the terminal device interface is the system interface corresponding to the target function. For example, if the target function is to turn on the vehicle's interior ceiling light, the native layer can find the terminal device interface that controls the interior ceiling light according to the function execution request, and turn on the vehicle's interior ceiling light through the terminal device interface.
[0037] In an embodiment of the present application, the application front end receives an execution instruction for a target function in the terminal device, generates a function execution request for the target function based on the function call toolkit, controls the function call toolkit to send the function execution request to the native layer, and controls the native layer to implement the target function based on the function execution request. By calling the toolkit to generate a function execution request to control the native layer to call the function of the terminal device, the application front end does not need to use the same system framework as the native layer to realize communication and use the functions of the terminal device, which improves the convenience of application development, reduces the difficulty of application development, and improves the adaptability of the application to different scenarios.
[0038] See also Figure 3 , which is a flowchart of a local function execution method provided in an embodiment of the present application. Figure 3 As shown, the method of the embodiment of the present application may include the following steps S201-S206.
[0039] S201, receiving an execution instruction for a target function in a terminal device based on an application front end.
[0040] Specifically, the local function execution device can control the application front end to display the display interface of the application on the display screen of the terminal device. Since the application can help users call the local functions of the terminal device, obtain the local information of the terminal device, etc., the display interface displays the buttons or prompt information corresponding to the local functions and local information of the terminal device, and the user inputs the execution instruction for the target function according to the buttons or prompt information on the display interface. Among them, the target function can be to call the local function of the terminal device, or to obtain the local information of the terminal device, etc. The execution instruction can be generated based on the user's click operation on the button or prompt information, or it can be generated based on the user's voice information. The local function execution device can receive the user's execution instruction for the target function in the terminal device based on the application front end, so as to realize the target function expected by the user according to the execution instruction.
[0041] S202: Generate a function execution request for a target function based on a function call toolkit.
[0042] Specifically, the local function execution device can control the application front end to send the received execution instruction to the function call toolkit, and then generate a function execution request for the target function based on the function call toolkit. Since the native layer can be developed based on the native system framework of the terminal device, it can be used to interact with the underlying hardware driver of the terminal device. The function execution request is used to request the native layer to implement the target function targeted by the execution instruction.
[0043] Optionally, the target function can be a local function of the terminal device, can be for obtaining local information of the terminal device, or can be a program function of a third-party application in the terminal device. It can be understood that different target functions will generate different function execution requests by the function call toolkit. The function execution request may include a function call request, an information acquisition request, and a permission acquisition request. The function call request is used to request the implementation of a local function, the function call request is used to request the acquisition of local information, and the permission acquisition request user requests the calling permission of a third-party application, and the calling permission can be used to call the program function of the third-party application.
[0044] If the target function is a target local function of the terminal device, the local function execution device can generate a function call request for the target local function based on the function call toolkit. The target local function is a local function in the terminal device. The function call request can be used to request the native layer to implement the target local function.
[0045] If the target function is to obtain the target local information of the terminal device, that is, the target function that the user wants to achieve is to obtain the target local information in the terminal device, and the target local information is a local information in the terminal device, then the local function execution device can generate an information acquisition request for the target local information based on the function call toolkit, and the information acquisition request can be used to request the native layer to obtain the target local information.
[0046] If the target function is a target program function of a third-party application in the terminal device, the local function execution device can generate a permission acquisition request for the third-party application based on the function call toolkit. The target program function is a program function that can be implemented by the third-party application, not a local function of the local device. Therefore, the local function execution device needs to obtain the calling permission of the third-party application before it can call the target program function of the third-party application. The permission acquisition request can be used to request the native layer to obtain the calling permission of the third-party application.
[0047] Please also see Figure 4 , provides an example schematic diagram of the target function implementation in the embodiment of the present application. The local function execution device can control the application front end to display a display interface to the user on the display screen of the terminal device. If the terminal device is a vehicle or a vehicle-mounted device of a vehicle, the local function execution device can display a display interface on the display screen of the vehicle-mounted device. The display interface can display buttons or prompt information for the local functions of the terminal device, the local information of the terminal device, and the program functions of third-party applications in the terminal device, so that the user can issue execution instructions to the application front end for the target function that is expected to be implemented. Figure 2As shown, the display interface displayed by the front end of the application may have buttons that facilitate users to call local functions of the terminal device, such as "turn on the ceiling light in the car", "open the rear window", etc. There may also be buttons that facilitate users to obtain local information of the terminal device, such as "GPS positioning", "current fuel tank oil level", etc. There may also be buttons that facilitate users to call program functions of third-party applications, such as "make an online call". It can be understood that the third-party application can be an application with a program function for online communication with other users. If the user wants to turn on the ceiling light in the car, the user can click the "turn on the ceiling light in the car" button, and the local function execution device can receive the user's execution instruction for the target function based on the front end of the application. At this time, the target function is to turn on the ceiling light in the car. After the local function execution device realizes the target function, the ceiling light in the car of the vehicle will turn on and light up.
[0048] S203, controlling the function call toolkit to send the function execution request to the native layer, and controlling the native layer to implement the target function based on the function execution request.
[0049] Specifically, after the function call toolkit generates a function execution request, the local function execution device can control the function call toolkit to send the function execution request to the native layer, and then control the native layer to implement the target function based on the function execution request.
[0050] Optionally, after the function call toolkit generates a function execution request, the local function execution device can control the function call toolkit to send the function execution request to the native layer based on the system communication interface. It can be understood that the system communication interface matches the native system framework of the native layer. For example, if the native layer is developed based on the Android system framework, the system communication interface can be the communication interface provided by the Android system framework. After the native layer receives the function execution request, it can control the native layer to call the terminal device interface corresponding to the target function based on the function execution request to implement the target function. For example, if the target function is to turn on the vehicle's interior ceiling light, the native layer can find the terminal device interface that controls the interior ceiling light according to the function execution request, and turn on the vehicle's interior ceiling light through the terminal device interface.
[0051] Optionally, if the target function is a target local function of the terminal device, that is, the function execution request is a function call request for the target local function, the local function execution device can control the native layer to call the target local function of the terminal device based on the function call request. For example, the native layer can be controlled to determine the terminal device interface corresponding to the target local function, and then call the target local function through the terminal device interface.
[0052] Optionally, if the target function is to obtain the target local information of the terminal device, that is, the function execution request is an information acquisition request for the target local information, the local function execution device can control the native layer to obtain the target local information of the terminal device based on the information acquisition request. For example, the native layer can be controlled to determine the terminal device interface for obtaining the target local information, and then the target local information is obtained through the terminal device interface.
[0053] Optionally, if the target function is a target program function of a third-party application in the terminal device, that is, the function execution request is a permission acquisition request for the third-party application, the local function execution device controls the function calling toolkit to send the permission acquisition request to the native layer, and then controls the native layer to obtain the calling permission of the third-party application based on the permission acquisition request, and controls the native layer to send the calling permission to the function calling toolkit, and controls the function calling toolkit to call the target program function of the third-party application based on the calling permission.
[0054] S204: If it is detected based on the native layer that the target function is successfully implemented, the native layer is controlled to generate callback information.
[0055] Specifically, since the native layer can interact with the underlying hardware driver of the terminal device, the native layer can detect whether the target function is successfully implemented. If the local function execution device detects that the target function is successfully implemented based on the native layer, it can control the native layer to generate callback information. It can be understood that the callback information is used to indicate that the target function is successfully implemented.
[0056] Optionally, if the target function is a target local function of the terminal device, based on the detection of successful implementation of the target local function by the native layer, the native layer is controlled to generate callback information for indicating the successful implementation of the target local function.
[0057] Optionally, if the target function is to obtain target local information of the terminal device, the native layer detects that the native layer has successfully obtained the target local information, and the native layer can be controlled to generate callback information based on the target local information, that is, the callback information includes the target local information.
[0058] S205, controlling the native layer to send the callback information to the function calling toolkit, and controlling the function calling toolkit to send the callback information to the application front end.
[0059] Specifically, after the native layer generates the callback information, the local function execution device can control the native layer to send the callback information to the function call toolkit. After the function call toolkit receives the callback information, the local function execution device can control the function call toolkit to send the callback information to the application front end.
[0060] S206, outputting callback information based on the application front end.
[0061] Specifically, after the application front end receives the callback information, the local function execution device can output the callback information based on the application front end and display the callback information to the user. The application front end can output the callback information in the form of voice or in the form of a pop-up window, that is, a pop-up window containing the callback information is displayed on the display interface of the terminal device.
[0062] Optionally, if the target function is a target local function of the terminal device, since the application front-end and the function calling toolkit cannot interact with the underlying hardware driver of the terminal device, they cannot directly call the target local function and cannot detect whether the target local function is successfully implemented. Therefore, the native layer is required to detect whether the target local function is successfully implemented and generate callback information to inform the application front-end and the function calling toolkit that the target local function is successfully implemented. Therefore, the callback information output by the application front-end is information to inform the user that the target local function is successfully implemented. For example, when the target function is to turn on the interior ceiling light, the application front-end outputs the callback message in the form of a pop-up window displaying "The interior ceiling light is turned on" on the display interface.
[0063] Optionally, if the target function is to obtain the target local information of the terminal device, since the native layer cannot directly display the target local information, the application front end and the function call toolkit cannot directly obtain the target local information of the terminal device, so the native layer is required to generate callback information containing the target local information. The purpose of the application front end outputting the callback information is to display the target local information to the user, so the form of the application front end outputting the callback information can be to output a pop-up window containing the target local information on the display interface.
[0064] It is understandable that if the target function is a target program function of a third-party application, the native layer only needs to obtain the calling permission of the third-party application, rather than using the native layer to call the target program function of the third-party application, so the native layer may not detect whether the target program function is successfully implemented, and may not generate callback information based on the successful implementation of the target program function. However, since the function call toolkit can call the target program function based on the calling permission, the local function execution device can detect whether the target program function is successfully implemented based on the function call toolkit. If the target program function is successfully implemented based on the function call toolkit, the function call toolkit can be controlled to generate callback information, and the function call toolkit can be controlled to send the callback information to the application front end, and the application front end can output the callback information.
[0065] In an embodiment of the present application, based on the application front end receiving the execution instruction for the target function in the terminal device, based on the function call toolkit, a function execution request for the target function is generated. The function execution request may include a function call request, an information acquisition request, and a permission acquisition request. The local function execution device can implement the local function, acquire local information, and call the program function of the third-party application based on the function execution request. The function call toolkit is controlled to send the function execution request to the native layer, and the native layer is controlled to implement the target function based on the function execution request. If the target function is to acquire the target local information of the terminal device, the local function execution device can control the native layer to acquire the target local information of the terminal device based on the information acquisition request. If the target function is the target program function of the third-party application in the terminal device, the local function execution device controls the function call toolkit to send the permission acquisition request to the native layer, and then controls the native layer to acquire the calling permission of the third-party application based on the permission acquisition request, and controls the native layer to send the calling permission to the function call toolkit, and controls the function call toolkit to call the target program function of the third-party application based on the calling permission. If the target function is successfully implemented based on the native layer, the native layer is controlled to generate callback information, the native layer is controlled to send the callback information to the function call toolkit, the function call toolkit is controlled to send the callback information to the application front end, and then the callback information is output based on the application front end to prompt the user that the target function is successfully implemented. By calling the toolkit to generate a function execution request to control the native layer to call the function of the terminal device, the application front end does not need to use the same system framework as the native layer to achieve communication and use the functions of the terminal device, which improves the convenience of application development, reduces the difficulty of application development, and improves the adaptability of the application to different scenarios.
[0066] The following will be combined with the attached Figure 5 -Attached Figure 6 , the local function execution device provided in the embodiment of the present application is introduced in detail. It should be noted that the attached Figure 5 -Attached Figure 6 The local function execution device in is used to execute this application Figure 2 and Figure 3 For the convenience of explanation, only the part related to the embodiment of the present application is shown. For the specific technical details not disclosed, please refer to the present application. Figure 2 and Figure 3 The embodiment shown.
[0067] See also Figure 5, which shows a schematic diagram of the structure of a local function execution device provided by an exemplary embodiment of the present application. The local function execution device can be implemented as all or part of the device through software, hardware or a combination of both. The device 1 includes an execution instruction receiving module 11, an execution request generating module 12 and a target function implementing module 13.
[0068] An execution instruction receiving module 11 is used to receive an execution instruction for a target function in the terminal device based on the application front end;
[0069] An execution request generating module 12, configured to generate a function execution request for the target function based on the function calling toolkit;
[0070] The target function implementation module 13 is used to control the function call toolkit to send the function execution request to the native layer, and control the native layer to implement the target function based on the function execution request.
[0071] In this embodiment, the application front end receives an execution instruction for a target function in the terminal device, generates a function execution request for the target function based on the function call toolkit, controls the function call toolkit to send the function execution request to the native layer, and controls the native layer to implement the target function based on the function execution request. By calling the toolkit to generate a function execution request to control the native layer to call the function of the terminal device, the application front end does not need to use the same system framework as the native layer to realize communication and use the functions of the terminal device, which improves the convenience of application development, reduces the difficulty of application development, and improves the adaptability of the application to different scenarios.
[0072] See also Figure 6 , which shows a schematic diagram of the structure of a local function execution device provided by an exemplary embodiment of the present application. The local function execution device can be implemented as all or part of the device through software, hardware or a combination of both. The device 1 includes an execution instruction receiving module 11, an execution request generating module 12, a target function implementing module 13 and a callback information display module 14.
[0073] An execution instruction receiving module 11 is used to receive an execution instruction for a target function in the terminal device based on the application front end;
[0074] An execution request generating module 12, configured to generate a function execution request for the target function based on the function calling toolkit;
[0075] Optionally, the execution request generation module 12 is specifically configured to generate a permission acquisition request for a third-party application based on the function call toolkit if the target function is a target program function of a third-party application in the terminal device.
[0076] Optionally, the execution request generation module 12 is specifically configured to generate an information acquisition request for the target local information based on the function call toolkit if the target function is to obtain target local information of the terminal device.
[0077] The target function implementation module 13 is used to control the function call toolkit to send the function execution request to the native layer, and control the native layer to implement the target function based on the function execution request.
[0078] Optionally, the target function implementation module 13 is specifically used to control the function call toolkit to send the function execution request to the native layer based on the system communication interface;
[0079] The native layer is controlled to call the terminal device interface corresponding to the target function based on the function execution request to implement the target function.
[0080] Optionally, the target function implementation module 13 is specifically used to control the function call toolkit to send the permission acquisition request to the native layer;
[0081] Control the native layer to obtain the calling permission of the third-party application based on the permission acquisition request, and send the calling permission to the function calling toolkit;
[0082] The function calling toolkit is controlled to call the target program function of the third-party application based on the calling permission.
[0083] Optionally, the target function implementation module 13 is specifically used to control the native layer to obtain the target local information based on the information acquisition request.
[0084] A callback information display module 14, configured to control the native layer to generate callback information if it is detected based on the native layer that the target function is successfully implemented;
[0085] Control the native layer to send the callback information to the function call toolkit, and control the function call toolkit to send the callback information to the application front end;
[0086] The callback information is output based on the application front end.
[0087] Optionally, the callback information display module 14 is specifically configured to control the native layer to generate callback information based on the target local information if it is detected that the native layer obtains the target local information.
[0088] In this embodiment, based on the application front end receiving the execution instruction for the target function in the terminal device, based on the function call toolkit, a function execution request for the target function is generated. The function execution request may include a function call request, an information acquisition request, and a permission acquisition request. The local function execution device may implement the local function, acquire local information, and call the program function of the third-party application based on the function execution request. The function call toolkit is controlled to send the function execution request to the native layer, and the native layer is controlled to implement the target function based on the function execution request. If the target function is to acquire the target local information of the terminal device, the local function execution device may control the native layer to acquire the target local information of the terminal device based on the information acquisition request. If the target function is the target program function of the third-party application in the terminal device, the local function execution device controls the function call toolkit to send the permission acquisition request to the native layer, and then controls the native layer to acquire the calling permission of the third-party application based on the permission acquisition request, and controls the native layer to send the calling permission to the function call toolkit, and controls the function call toolkit to call the target program function of the third-party application based on the calling permission. If the target function is successfully implemented based on the native layer, the native layer is controlled to generate callback information, the native layer is controlled to send the callback information to the function call toolkit, the function call toolkit is controlled to send the callback information to the application front end, and then the callback information is output based on the application front end to prompt the user that the target function is successfully implemented. By calling the toolkit to generate a function execution request to control the native layer to call the function of the terminal device, the application front end does not need to use the same system framework as the native layer to achieve communication and use the functions of the terminal device, which improves the convenience of application development, reduces the difficulty of application development, and improves the adaptability of the application to different scenarios.
[0089] It should be noted that the local function execution device provided in the above embodiment only uses the division of the above functional modules as an example when executing the local function execution method. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the local function execution device provided in the above embodiment and the local function execution method embodiment belong to the same concept, and the implementation process thereof is detailed in the method embodiment, which will not be repeated here.
[0090] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.
[0091] The present application also provides a computer storage medium, which can store multiple instructions, and the instructions are suitable for being loaded and executed by a processor as described above. Figure 1-Figure 4 The local function execution method of the embodiment shown in the figure can be found in the specific execution process. Figure 1-Figure 4 The specific description of the illustrated embodiment will not be repeated here.
[0092] The present application also provides a computer program product, which stores at least one instruction, and the at least one instruction is loaded and executed by the processor as described above. Figure 1-Figure 4 The local function execution method of the embodiment shown in the figure can be found in the specific execution process. Figure 1-Figure 4 The specific description of the illustrated embodiment will not be repeated here.
[0093] Please refer to Figure 7 , which shows a block diagram of the structure of an electronic device provided by an exemplary embodiment of the present application. The electronic device in the present application may include one or more of the following components: a processor 110, a memory 120, an input device 130, an output device 140, and a bus 150. The processor 110, the memory 120, the input device 130, and the output device 140 may be connected via the bus 150.
[0094] The processor 110 may include one or more processing cores. The processor 110 uses various interfaces and lines to connect various parts of the entire electronic device, and executes various functions and processes data of the terminal 100 by running or executing instructions, programs, code sets or instruction sets stored in the memory 120, and calling data stored in the memory 120. Optionally, the processor 110 can be implemented in at least one hardware form of digital signal processing (DSP), field-programmable gate array (FPGA), and programmable logic array (PLA). The processor 110 can integrate one or a combination of a central processing unit (CPU), a graphics processing unit (GPU), and a modem. Among them, the CPU mainly processes the operating system, user pages, and applications; the GPU is responsible for rendering and drawing display content; and the modem is used to process wireless communications. It can be understood that the above-mentioned modem may not be integrated into the processor 110, but may be implemented separately through a communication chip.
[0095] The memory 120 may include a random access memory (RAM) or a read-only memory (ROM). Optionally, the memory 120 includes a non-transitory computer-readable medium (Non-Transitory Computer-Readable Storage Medium). The memory 120 may be used to store instructions, programs, codes, code sets or instruction sets. The memory 120 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for implementing at least one function (such as a touch function, a sound playback function, an image playback function, etc.), instructions for implementing the above-mentioned various method embodiments, etc. The operating system may be an Android system, including a system deeply developed based on the Android system, an IOS system developed by Apple, including a system deeply developed based on the IOS system or other systems.
[0096] The memory 120 can be divided into an operating system space and a user space. The operating system runs in the operating system space, and native and third-party applications run in the user space. In order to ensure that different third-party applications can achieve good operating results, the operating system allocates corresponding system resources to different third-party applications. However, the requirements for system resources in different application scenarios in the same third-party application are also different. For example, in the local resource loading scenario, the third-party application has higher requirements for disk reading speed; in the animation rendering scenario, the third-party application has higher requirements for GPU performance. The operating system and third-party applications are independent of each other, and the operating system often cannot perceive the current application scenario of the third-party application in a timely manner, resulting in the operating system being unable to perform targeted system resource adaptation according to the specific application scenario of the third-party application.
[0097] In order for the operating system to distinguish the specific application scenarios of third-party applications, it is necessary to open up data communication between third-party applications and the operating system so that the operating system can obtain the current scenario information of third-party applications at any time, and then perform targeted system resource adaptation based on the current scenario.
[0098] The input device 130 is used to receive input commands or data, and includes but is not limited to a keyboard, a mouse, a camera, a microphone, or a touch device. The output device 140 is used to output commands or data, and includes but is not limited to a display device and a speaker. In one example, the input device 130 and the output device 140 can be combined, and the input device 130 and the output device 140 are touch screen displays.
[0099] The touch display screen can be designed as a full screen, a curved screen or a special-shaped screen. The touch display screen can also be designed as a combination of a full screen and a curved screen, or a combination of a special-shaped screen and a curved screen, which is not limited in the embodiments of the present application.
[0100] In addition, those skilled in the art will appreciate that the structure of the electronic device shown in the above drawings does not constitute a limitation on the electronic device, and the electronic device may include more or fewer components than shown, or combine certain components, or arrange the components differently. For example, the electronic device also includes a radio frequency circuit, an input unit, a sensor, an audio circuit, a wireless fidelity (WiFi) module, a power supply, a Bluetooth module and other components, which will not be described in detail here.
[0101] exist Figure 7 In the electronic device shown, the processor 110 may be used to call a local function execution application stored in the memory 120, and specifically perform the following operations:
[0102] Receiving an execution instruction for a target function in the terminal device based on the application front end;
[0103] generating a function execution request for the target function based on the function call toolkit;
[0104] The function call toolkit is controlled to send the function execution request to the native layer, and the native layer is controlled to implement the target function based on the function execution request.
[0105] In one embodiment, the processor 110 specifically performs the following operations when controlling the function call toolkit to send the function execution request to the native layer and controlling the native layer to implement the target function based on the function execution request:
[0106] Based on the system communication interface, control the function call toolkit to send the function execution request to the native layer;
[0107] The native layer is controlled to call the terminal device interface corresponding to the target function based on the function execution request to implement the target function.
[0108] In one embodiment, when the processor 110 generates a function execution request for the target function based on the function call toolkit, the processor 110 specifically performs the following operations:
[0109] If the target function is a target program function of a third-party application in the terminal device, a permission acquisition request for the third-party application is generated based on the function call toolkit.
[0110] In one embodiment, the processor 110 specifically performs the following operations when controlling the function call toolkit to send the function execution request to the native layer and controlling the native layer to implement the target function based on the function execution request:
[0111] Controlling the function call toolkit to send the permission acquisition request to the native layer;
[0112] Control the native layer to obtain the calling permission of the third-party application based on the permission acquisition request, and send the calling permission to the function calling toolkit;
[0113] The function calling toolkit is controlled to call the target program function of the third-party application based on the calling permission.
[0114] In one embodiment, when executing the local function execution method, the processor 110 further performs the following operations:
[0115] If it is detected based on the native layer that the target function is successfully implemented, controlling the native layer to generate callback information;
[0116] Control the native layer to send the callback information to the function call toolkit, and control the function call toolkit to send the callback information to the application front end;
[0117] The callback information is output based on the application front end.
[0118] In one embodiment, when the processor 110 generates a function execution request for the target function based on the function call toolkit, the processor 110 specifically performs the following operations:
[0119] If the target function is to obtain target local information of the terminal device, generating an information acquisition request for the target local information based on the function calling toolkit;
[0120] When executing and controlling the native layer to implement the target function based on the function execution request, the following operations are specifically performed:
[0121] The native layer is controlled to obtain the target local information based on the information acquisition request.
[0122] In one embodiment, when the processor 110 controls the native layer to generate callback information if it is detected based on the native layer that the target function is successfully implemented, the processor 110 specifically performs the following operations:
[0123] If it is detected that the native layer obtains the target local information, the native layer is controlled to generate callback information based on the target local information.
[0124] In this embodiment, based on the application front end receiving the execution instruction for the target function in the terminal device, based on the function call toolkit, a function execution request for the target function is generated. The function execution request may include a function call request, an information acquisition request, and a permission acquisition request. The local function execution device may implement the local function, acquire local information, and call the program function of the third-party application based on the function execution request. The function call toolkit is controlled to send the function execution request to the native layer, and the native layer is controlled to implement the target function based on the function execution request. If the target function is to acquire the target local information of the terminal device, the local function execution device may control the native layer to acquire the target local information of the terminal device based on the information acquisition request. If the target function is the target program function of the third-party application in the terminal device, the local function execution device controls the function call toolkit to send the permission acquisition request to the native layer, and then controls the native layer to acquire the calling permission of the third-party application based on the permission acquisition request, and controls the native layer to send the calling permission to the function call toolkit, and controls the function call toolkit to call the target program function of the third-party application based on the calling permission. If the target function is successfully implemented based on the native layer, the native layer is controlled to generate callback information, the native layer is controlled to send the callback information to the function call toolkit, the function call toolkit is controlled to send the callback information to the application front end, and then the callback information is output based on the application front end to prompt the user that the target function is successfully implemented. By calling the toolkit to generate a function execution request to control the native layer to call the function of the terminal device, the application front end does not need to use the same system framework as the native layer to achieve communication and use the functions of the terminal device, which improves the convenience of application development, reduces the difficulty of application development, and improves the adaptability of the application to different scenarios.
[0125] It should be noted that the information (including but not limited to user device information, user personal information, etc.), data (including but not limited to data used for analysis, stored data, displayed data, etc.) and signals involved in the embodiments of this specification are all authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions. For example, the call permissions and target local information involved in this specification are all obtained with full authorization.
[0126] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing related hardware through a computer program, and the program can be stored in a computer-readable storage medium, and when the program is executed, it can include the processes of the embodiments of the above-mentioned methods. The storage medium can be a disk, an optical disk, a read-only storage memory, or a random access memory, etc.
[0127] The above disclosure is only the preferred embodiment of the present application, which certainly cannot be used to limit the scope of rights of the present application. Therefore, equivalent changes made according to the claims of the present application are still within the scope covered by the present application.
Claims
1. A local function execution method, characterized in that: An application program applied to a terminal device, the application program comprising an application front end, a function calling toolkit and a native layer, the method comprising: Receiving an execution instruction for a target function in the terminal device based on the application front end; generating a function execution request for the target function based on the function call toolkit; The function call toolkit is controlled to send the function execution request to the native layer, and the native layer is controlled to implement the target function based on the function execution request.
2. The method according to claim 1, characterized in that The controlling the function call toolkit to send the function execution request to the native layer, and controlling the native layer to implement the target function based on the function execution request, includes: Based on the system communication interface, control the function call toolkit to send the function execution request to the native layer; The native layer is controlled to call the terminal device interface corresponding to the target function based on the function execution request to implement the target function.
3. The method according to claim 1, characterized in that The generating a function execution request for the target function based on the function call toolkit includes: If the target function is a target program function of a third-party application in the terminal device, a permission acquisition request for the third-party application is generated based on the function call toolkit.
4. The method according to claim 1, characterized in that The controlling the function call toolkit to send the function execution request to the native layer, and controlling the native layer to implement the target function based on the function execution request, includes: Controlling the function call toolkit to send the permission acquisition request to the native layer; Control the native layer to obtain the calling permission of the third-party application based on the permission acquisition request, and send the calling permission to the function calling toolkit; The function calling toolkit is controlled to call the target program function of the third-party application based on the calling permission.
5. The method according to claim 1, characterized in that: The method further comprises: If it is detected based on the native layer that the target function is successfully implemented, controlling the native layer to generate callback information; Control the native layer to send the callback information to the function call toolkit, and control the function call toolkit to send the callback information to the application front end; The callback information is output based on the application front end.
6. The method according to claim 5, characterized in that The generating a function execution request for the target function based on the function call toolkit includes: If the target function is to obtain target local information of the terminal device, generating an information acquisition request for the target local information based on the function calling toolkit; The controlling the native layer to implement the target function based on the function execution request includes: The native layer is controlled to obtain the target local information based on the information acquisition request.
7. The method according to claim 6, characterized in that If the target function is successfully implemented based on the detection of the native layer, controlling the native layer to generate callback information includes: If it is detected that the native layer obtains the target local information, the native layer is controlled to generate callback information based on the target local information.
8. A local function execution device, characterized in that: An application program applied to a terminal device, the application program comprising an application front end, a function calling toolkit and a native layer, and the apparatus comprising: An execution instruction receiving module, used for receiving an execution instruction for a target function in the terminal device based on the application front end; An execution request generation module, used for generating a function execution request for the target function based on the function call toolkit; The target function implementation module is used to control the function call toolkit to send the function execution request to the native layer, and control the native layer to implement the target function based on the function execution request.
9. A computer storage medium, characterized in that: The computer storage medium stores a plurality of instructions, and the instructions are suitable for being loaded by a processor and executing the method steps according to any one of claims 1 to 7.
10. An electronic device, characterized in that: include: A processor and a memory; wherein the memory stores a computer program, and the computer program is suitable for being loaded by the processor and executing the method steps as claimed in any one of claims 1 to 7.