Application program running method, electronic device and storage medium

By loading and merging subpackages when the application starts, and updating the file name of the target class file to achieve functional registration, the plug-in application registration problem is solved to ensure the normal operation and user experience of the application.

CN114860335BActive Publication Date: 2024-11-26ZHANGYUE TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210456071.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-04-27
Publication Date
2024-11-26
Estimated Expiration
2042-04-27

AI Technical Summary

Technical Problem

Plugin applications cannot actively implement plug-in registration when they are started, resulting in plug-in functions being unable to register normally, affecting the operation and user experience of the application.

Method used

By detecting the startup operation of the application, loading the sub-package, merging the executable file, updating the file name of the target class file, so that it can be recognized when the function is registered, thereby achieving the registration of the target function.

Benefits of technology

Ensure that the application can run normally, meet the user's functional needs, and improve the user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114860335B_ABST
    Figure CN114860335B_ABST
Patent Text Reader

Abstract

The present disclosure relates to a method for running an application, an electronic device and a storage medium. The method for running an application includes: in response to detecting a startup operation on the application, loading a sub-program package in the application to obtain a first executable file corresponding to the sub-program package; merging the first executable file with the second executable file corresponding to the application to obtain a third executable file; updating the file name of the target class file in the third executable file to the target file name to obtain a fourth executable file, the target class file is a function class file corresponding to the sub-program package, and the target file name is a file name that can be identified when the function is registered; according to the fourth executable file, registering the target function corresponding to the target class file to run the application. According to the embodiment of the present disclosure, it is possible to register the functions corresponding to the sub-program packages in the plug-in application, so that the application can run normally, thereby meeting the user's usage needs and improving the user experience.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of computer technology, and in particular to a method for running an application, an electronic device, and a storage medium. Background Art

[0002] On smart terminals, users can use third-party applications (Application, APP) to meet their own usage needs. In order to facilitate user use and improve user experience, some corresponding functions can often be implemented through APP function plug-in methods.

[0003] However, in plug-in APPs, due to the delayed loading characteristics of the corresponding plug-ins, the plug-in APP cannot actively register the plug-ins at startup, which makes it impossible to register the functions corresponding to the plug-in APP plug-ins normally, thereby affecting the normal operation of the plug-in APP, and then failing to meet the user's functional requirements, affecting the user experience. Summary of the invention

[0004] In order to solve the above technical problems or at least partially solve the above technical problems, the present disclosure provides a method for running an application, an electronic device, and a storage medium.

[0005] In a first aspect, the present disclosure provides a method for running an application, comprising:

[0006] In response to detecting a startup operation on the application, loading a sub-program package in the application to obtain a first executable file corresponding to the sub-program package;

[0007] Merging the first executable file with the second executable file corresponding to the application program to obtain a third executable file;

[0008] The file name of the target class file in the third executable file is updated to the target file name to obtain a fourth executable file, where the target class file is a function class file corresponding to the subprogram package, and the target file name is a file name that can be identified when the function is registered;

[0009] According to the fourth executable file, the target function corresponding to the target class file is registered to run the application program.

[0010] In a second aspect, the present disclosure provides an electronic device, including a processor and a memory, wherein the memory is used to store executable instructions, and the executable instructions enable the processor to perform the following operations:

[0011] In response to detecting a startup operation on the application, loading a sub-program package in the application to obtain a first executable file corresponding to the sub-program package;

[0012] Merging the first executable file with the second executable file corresponding to the application program to obtain a third executable file;

[0013] The file name of the target class file in the third executable file is updated to the target file name to obtain a fourth executable file, where the target class file is a function class file corresponding to the subprogram package, and the target file name is a file name that can be identified when the function is registered;

[0014] According to the fourth executable file, the target function corresponding to the target class file is registered to run the application program.

[0015] In a third aspect, the present disclosure provides a computer-readable storage medium storing a computer program. When the computer program is executed by a processor, the processor implements the method for running the application program of the first aspect.

[0016] Compared with the prior art, the technical solution provided by the embodiments of the present disclosure has the following advantages:

[0017] The application running method, electronic device and storage medium of the disclosed embodiment can detect and respond to the user's startup operation on the application, load the sub-program package in the application, obtain the first executable file corresponding to the sub-program package, then merge the first executable file with the second executable file corresponding to the application to obtain the third executable file, and then update the file name of the target class file in the third executable file to the target file name to obtain the fourth executable file, and then register the target function corresponding to the target class file according to the fourth executable file to run the application. Since the target class file is the function class file corresponding to the sub-program package, and the target file name is a file name that can be identified when registering the function, the target function corresponding to the target class file can be registered based on the identifiable target file name, so that the application can run normally, thereby meeting the user's functional requirements and improving the user experience. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the accompanying drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and the originals and elements are not necessarily drawn to scale.

[0019] Figure 1 A schematic diagram showing a flow chart of a method for running an application program provided by an embodiment of the present disclosure;

[0020] Figure 2 A schematic diagram showing a flow chart of another method for running an application program provided by an embodiment of the present disclosure;

[0021] Figure 3A flow chart of a content provider function registration method provided by an embodiment of the present disclosure is shown;

[0022] Figure 4 A flow chart of a content receiver function registration method provided by an embodiment of the present disclosure is shown;

[0023] Figure 5 A schematic structural diagram of an electronic device provided by an embodiment of the present disclosure is shown. DETAILED DESCRIPTION

[0024] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments described herein, which are instead provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not intended to limit the scope of protection of the present disclosure.

[0025] It should be understood that the various steps described in the method embodiments of the present disclosure may be performed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present disclosure is not limited in this respect.

[0026] The term "including" and its variations used herein are open inclusions, i.e., "including but not limited to". The term "based on" means "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". The relevant definitions of other terms will be given in the following description.

[0027] It should be noted that the concepts such as "first" and "second" mentioned in the present disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.

[0028] It should be noted that the modifications of "one" and "plurality" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".

[0029] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only used for illustrative purposes and are not used to limit the scope of these messages or information.

[0030] Embodiments of the present disclosure provide a method for running an application, an electronic device, and a storage medium.

[0031] Next, first combine Figure 1 The method for running the application provided by the embodiment of the present disclosure is described.

[0032] The method for running an application provided in the embodiments of the present disclosure may be performed by an electronic device capable of running an application, wherein the electronic device may include but is not limited to mobile terminals such as smart phones, laptop computers, personal digital assistants (PDAs), tablet computers (PADs), portable multimedia players (PMPs), vehicle terminals (such as vehicle navigation terminals), wearable devices, etc., and fixed terminals such as digital TVs, desktop computers, smart home devices, etc.

[0033] Figure 1 A flowchart of a method for running an application provided by an embodiment of the present disclosure is shown.

[0034] like Figure 1 As shown, the method for running the application may include the following steps.

[0035] S110 . In response to detecting a startup operation on an application program, a sub-program package in the application program is loaded to obtain a first executable file corresponding to the sub-program package.

[0036] In the disclosed embodiment, when a user wants to start an application in an electronic device, he can input a start operation of the application to the electronic device. After detecting the start operation, the electronic device can load the sub-program package in the application in response to the start operation, and then obtain the first executable file corresponding to the sub-program package.

[0037] In the embodiment of the present disclosure, the startup operation may be any operation that can trigger the electronic device to start an application.

[0038] Optionally, the start operation may be a gesture control operation (such as click, long press, double click, etc.), a voice control operation, or an expression control operation on the program icon of the application, which is not limited here.

[0039] In the embodiment of the present disclosure, the application program may be an application program to be started.

[0040] Optionally, the application program may be any plug-in application program, for example, the application program may be a plug-in e-book application program, a video player application program, a navigation application program, a game application program, a chat application program, etc., which are not limited here.

[0041] Among them, plug-in applications are applications composed of some dynamic independent modules, each of which can realize at least one service function. Each independent module of a plug-in application can meet certain plug-in protocols and can realize communication between the main program and independent modules, and between independent modules with the help of the main program.

[0042] Optionally, a sub-program package may be a program package corresponding to a module in an application.

[0043] Optionally, the first executable file may be any type of installed file that can be executed to implement the plug-in module function corresponding to the sub-program package. For example, the first executable file may be a dex file, and the dex file may be a collection of multiple class files.

[0044] Specifically, after detecting a user's startup operation on an application, the electronic device may load a sub-program package included in the application in response to the startup operation, and then obtain a first executable file corresponding to the sub-program package.

[0045] The following is a detailed description of the method for loading a sub-program package on an electronic device.

[0046] Optionally, loading the sub-program package in S110 to obtain the first executable file corresponding to the sub-program package may specifically include: downloading an installation package file corresponding to the sub-program package; and installing the sub-program package based on the installation package file to obtain the first executable file corresponding to the sub-program package.

[0047] In the disclosed embodiment, the electronic device may download the installation package file corresponding to the sub-program package based on the download information of the sub-program package, and install the sub-program package based on the installation package file, thereby obtaining the first executable file corresponding to the sub-program package.

[0048] Optionally, the download information may be information for downloading a sub-program package, for example, may include the name of the sub-program package, the download address of the sub-program package, etc.

[0049] Optionally, the installation package file may include all files installed by the sub-program package.

[0050] Specifically, the electronic device can download the installation package file corresponding to the sub-program package based on the download information of the sub-program package, and then decompress the installation package file, and then the electronic device can search for and obtain the first executable file in the decompressed installation package file.

[0051] Therefore, in the embodiment of the present disclosure, the electronic device can load the sub-program package to achieve the loading of the related modules in the plug-in application.

[0052] S120: Merge the first executable file with the second executable file corresponding to the application program to obtain a third executable file.

[0053] In an embodiment of the present disclosure, after obtaining the first executable file, the electronic device can merge the first executable file with the second executable file corresponding to the application to obtain a third executable file, so as to obtain a complete executable file corresponding to the application, so that all files of the application can be called in one executable file.

[0054] Optionally, S120 may specifically include: searching for a second executable file corresponding to the application; and adding the first executable file to a folder of the second executable file to obtain a third executable file.

[0055] In the disclosed embodiment, after obtaining the first executable file, the electronic device may also search for the main program package in the application and obtain the second executable file corresponding to the main program package, and then merge the first executable file and the second executable file, that is, add the first executable file to the folder of the second executable file to obtain a third executable file.

[0056] Optionally, the second executable file is similar to the first executable file, and the second executable file may be a dex executable file in the main program package, which will not be described in detail here.

[0057] Optionally, the third executable file may be a dex executable file obtained by merging the first executable file and the second executable file.

[0058] Specifically, after obtaining the first executable file, the electronic device can also search for the second executable file in all files corresponding to the application, that is, search for the second executable file corresponding to the main program package, and obtain the second executable file after finding the second executable file, and then add the first executable file to the folder of the second executable file, that is, add multiple class files in the dex file of the first executable file to multiple class files in the dex file of the second executable file, so that the first executable file is merged with the second executable file to obtain a third executable file.

[0059] Therefore, in the embodiment of the present disclosure, the electronic device merges the first executable file with the second executable file to obtain a third executable file, so that the application can run normally, thereby meeting the user's functional requirements and improving the user experience.

[0060] S130. Update the file name of the target class file in the third executable file to the target file name to obtain a fourth executable file. The target class file is a function class file corresponding to the sub-program package. The target file name is a file name that can be identified when the function is registered.

[0061] In an embodiment of the present disclosure, after obtaining the third executable file, the electronic device can update the file name of the target class file in the third executable file to the target file name. The target class file can be a functional class file corresponding to the sub-program package in the third executable file, and then the fourth executable file can be obtained.

[0062] Optionally, the target class file may be a function class file corresponding to the sub-program package. The target class file may be used to register the target function.

[0063] Optionally, the function class file may be a file used to implement a specified function.

[0064] Optionally, the target function may be a function that can be realized by an application program. Taking the application program as a plug-in e-book application program as an example, the target function may be an e-book reading function, an e-book flipping function, and the like.

[0065] Optionally, the target file name may be a file name that can be recognized by the electronic device when registering the function class file.

[0066] Specifically, after obtaining the third executable file, the electronic device can first determine the target function that needs to be registered in the sub-program package, and determine the corresponding function class file based on the target function, that is, the corresponding target class file, and then update the file name of the target class file, so that the file name of the target class file is updated to a target file name that can be recognized by the electronic device when registering the function, thereby obtaining the updated fourth executable file.

[0067] S140. Register a target function corresponding to the target class file according to the fourth executable file to run the application program.

[0068] In the disclosed embodiment, after obtaining the fourth executable file, the electronic device may register the target function corresponding to the target class file with the updated file name in the fourth executable file, thereby running the application based on the target function.

[0069] Specifically, after obtaining the fourth executable file, the electronic device can call and register the target class file in the fourth executable file based on the target file name, thereby obtaining the target function corresponding to the target class file, and then running the application based on the target function.

[0070] Therefore, in the disclosed embodiment, after detecting and responding to the user's startup operation on the application, the sub-program package in the application is loaded to obtain a first executable file corresponding to the sub-program package, and then the first executable file is merged with the second executable file corresponding to the application to obtain a third executable file, and then the file name of the target class file in the third executable file is updated to the target file name to obtain a fourth executable file, and then according to the fourth executable file, the target function corresponding to the target class file is registered to run the application. Since the target class file is a function class file corresponding to the sub-program package, and the target file name is a file name that can be recognized when registering the function, the target function corresponding to the target class file can be registered based on the recognizable target file name, so that the application can run normally, thereby meeting the user's functional requirements and improving the user experience.

[0071] In some embodiments of the present disclosure, after receiving a startup operation, the electronic device needs to detect whether there is a sub-program package to be loaded in the application, and based on the detection result, determine whether the corresponding sub-program package needs to be loaded, which is described in detail below.

[0072] Optionally, before loading the sub-program package in the application and obtaining the first executable file corresponding to the sub-program package, the method for running the application may further include: detecting whether there is a sub-program package to be loaded in the application.

[0073] In the disclosed embodiment, before loading a sub-program package in an application and obtaining a first executable file corresponding to the sub-program package, the electronic device may first detect whether there is a sub-program package to be loaded in the application.

[0074] Optionally, the sub-program package to be loaded may be a sub-program package required to be loaded when starting the application program.

[0075] Specifically, after detecting the startup operation, the electronic device can detect the loading status of all sub-program packages in the application. If there is a sub-program package with a loading status of unloaded, it is determined that there is an unloaded sub-program package; otherwise, it is determined that there is no unloaded sub-program package.

[0076] Furthermore, loading the sub-program package in the application to obtain the first executable file corresponding to the sub-program package may specifically include: when detecting that the sub-program package exists in the application, loading the sub-program package to obtain the first executable file corresponding to the sub-program package.

[0077] In the disclosed embodiment, after the electronic device detects whether there is a sub-program package to be loaded in the application, if it is detected that there is a sub-program package to be loaded in the application, the electronic device can load the sub-program package and obtain a first executable file corresponding to the sub-program package.

[0078] In other embodiments, after the electronic device detects whether there is a sub-program package to be loaded in the application, if no sub-program package to be loaded is detected in the application, the electronic device can directly run the application without loading the target class file corresponding to the sub-program package and registering the target function corresponding to the target class file.

[0079] Therefore, in the disclosed embodiment, the electronic device loads the sub-program package only when there is a sub-program package to be loaded in the application, so that the application can run normally, thereby meeting the user's functional requirements and improving the user experience.

[0080] In some other embodiments of the present disclosure, the electronic device may update the file name of the target class file in the third executable file based on a reflection mechanism, which is described in detail below.

[0081] Optionally, S130 may specifically include:

[0082] S1301. Based on the reflection mechanism, call the subroutine package.

[0083] In the embodiment of the present disclosure, after acquiring the third executable file, the electronic device can call the sub-program package based on the reflection mechanism.

[0084] Optionally, the reflection mechanism can be used to call the property information and construction method corresponding to the sub-package.

[0085] Specifically, after obtaining the third executable file, the electronic device can obtain multiple class files in the third executable file through the reflection mechanism, obtain the attribute information and construction methods corresponding to the class files, create objects corresponding to the class based on the attribute information and construction methods, and thus call the subroutine package.

[0086] S1302: parse the sub-program package to obtain a target function list in the sub-program package, where the target function list includes the target function.

[0087] In the embodiment of the present disclosure, after calling the attribute information and the construction method corresponding to the sub-program package, the electronic device parses the sub-program package to obtain a target function list including the target functions in the sub-program package.

[0088] Specifically, after calling the attribute information and construction method corresponding to the sub-program package, the electronic device can disassemble and analyze the sub-program package according to the attribute information and the construction method, split the installation package corresponding to the sub-program package into multiple file packages, and aggregate and query the file package storing the target function list in the multiple file packages, thereby extracting the target function list corresponding to the target function from the queried file package.

[0089] S1303. Based on the target function list, update the file name of the target class file corresponding to the target function in the third executable file to the target file name to obtain a fourth executable file.

[0090] In an embodiment of the present disclosure, after the electronic device obtains the target function list including the target function in the sub-program package, based on the target function list, it can update the file name of the target class file corresponding to the target function in the third executable file to the target file name, thereby obtaining a fourth executable file.

[0091] Specifically, after obtaining the target function list including the target function in the sub-program package, the electronic device can determine the target class file corresponding to the target function according to the target function included in the target function list, and update the file name of the target class file so that the file name of the target class file is updated to the target file name, thereby obtaining a fourth executable file.

[0092] Further, S1303 may specifically include: determining a function name of the target function based on the target function list; searching for a target class file having the function name in the third executable file; changing the package name in the file name of the target class file from a first package name corresponding to the subprogram package to a second package name corresponding to the application program, so as to update the file name of the target class file to the target file name, and obtain a fourth executable file.

[0093] In an embodiment of the present disclosure, after obtaining a target function list including the target function in the sub-program package, the electronic device can determine the function name of the target function included in the target function list based on the target function list, and then search for a target class file with the function name in the third executable file according to the function name. After querying the target class file, the electronic device can traverse and change the package name in the file name of the target class file from the first package name corresponding to the sub-program package to the second package name corresponding to the application program, thereby updating the file name of the target class file to the target file name, and obtaining the fourth executable file.

[0094] Optionally, the package name may be a name used to characterize the application to which the file belongs. The first package name may be used to characterize that the file belongs to a sub-program package, and the second package name may be used to characterize that the file belongs to the application described in the sub-program package.

[0095] Specifically, after the electronic device obtains the target function list including the target function in the sub-program package, it traverses the target function list, that is, it starts from the first target function in the target function list, determines the first target function, and searches the third executable file for the target class file corresponding to the first target function, and changes the package name in the file name of the target class file from the first package name corresponding to the sub-program package to the second package name corresponding to the application. Then, the second target function is determined from the target function list, and the third executable file is searched for the target class file corresponding to the second target function, and the package name in the file name of the target class file is changed from the first package name corresponding to the sub-program package to the second package name corresponding to the application. The updates are performed in sequence, so that the file names of the target class files corresponding to all the target functions in the target function list are updated to the target file names corresponding to the application, thereby obtaining the fourth executable file.

[0096] Therefore, in the disclosed embodiment, the file name of the target class file corresponding to the target function in the sub-program package is updated to the target file name, so that the file name of the target class file updated to the target file name can be recognized during registration, thereby enabling the target function corresponding to the target class file to be successfully registered, allowing the application to run normally, thereby meeting the user's functional requirements and improving the user experience.

[0097] In still other embodiments of the present disclosure, the target function may include a content provider function and / or a content receiver function.

[0098] In some embodiments, the target function may include a content provider function, and the target class file corresponding to the target function may include a class file of the content provider function.

[0099] Optionally, S140 may specifically include: acquiring an active thread corresponding to the target function; and calling, through the active thread, a target class file in the fourth executable file according to the target file name to register the target function.

[0100] In an embodiment of the present disclosure, after the electronic device obtains the target function list including the target function in the sub-program package, the content provider (Content Provider) function included in the target function can be obtained, and the target class file corresponding to the target function can include the class file corresponding to the content provider function.

[0101] Furthermore, the electronic device may obtain an active thread corresponding to the target function, and through the active thread, call the target class file in the fourth executable file according to the target file name to register the target function.

[0102] Optionally, the active thread may be a thread that registers the target function.

[0103] Specifically, after obtaining the target function, the electronic device can create a new active thread, and then obtain the main thread (ActivityThread), which can be the entry of the activity thread. After obtaining the main thread, the electronic device can call a component in the activity thread, such as the ContentProvider component, and call the target class file in the fourth executable file corresponding to the target file name through the component to register the target function.

[0104] Therefore, in the disclosed embodiment, the electronic device can register the target function so that the application can run normally, thereby meeting the user's functional requirements and improving the user experience.

[0105] In other embodiments, the target function may include a content receiver function, and the target class file may include a class file of the content receiver function.

[0106] Optionally, registering a target function corresponding to the target class file according to the target file name may specifically include: registering the target function corresponding to the target class file in the fourth executable file through a native registration method corresponding to the application.

[0107] In the embodiment of the present disclosure, the electronic device may also obtain a content receiver (BroadcastReceiver) function included in the target function, and the target class file corresponding to the target function may include a class file corresponding to the content receiver function.

[0108] Furthermore, the electronic device may register the target function corresponding to the target class file in the fourth executable file through a native registration method corresponding to the application program.

[0109] Optionally, the native registration method may be a BroadcastReceiver dynamic registration method.

[0110] Specifically, after obtaining the target class file in the fourth executable file, the electronic device can register the target function corresponding to the target class file through a native registration method based on the target class file.

[0111] In still other embodiments, the target function may include a content provider function and a content receiver function, and the target class file corresponding to the target function may include a class file of the content provider function and a class file of the content receiver function.

[0112] In an embodiment of the present disclosure, after the electronic device obtains the target function list including the target function in the sub-program package, the electronic device can obtain the content provider (Content Provider) function included in the target function, and the target class file corresponding to the target function can include the class file corresponding to the content provider function, and the electronic device can also obtain the content receiver (BroadcastReceiver) function included in the target function, and the target class file corresponding to the target function can include the class file corresponding to the content receiver function.

[0113] Furthermore, the electronic device can obtain an active thread corresponding to the target function, and through the active thread, call the target class file in the fourth executable file according to the target file name to realize the registration of the target function. It can also register the target function corresponding to the target class file in the fourth executable file through the native registration method corresponding to the application. The specific implementation method is referred to above and will not be repeated here.

[0114] Therefore, in the disclosed embodiment, the electronic device can register the target function so that the application can run normally, thereby meeting the user's functional requirements and improving the user experience.

[0115] Combine the following Figure 2 and Figure 3 The specific processes corresponding to the content provider function and the content receiver function are described in detail.

[0116] Figure 2 A flow chart of a content provider function registration method provided by an embodiment of the present disclosure is shown.

[0117] like Figure 2 As shown, the content provider function registration method may include the following steps.

[0118] S210: Obtain the class to be loaded.

[0119] In an embodiment of the present disclosure, the electronic device may obtain a class to be loaded.

[0120] Optionally, the class to be loaded may be a class for loading class files, for example, a PackageParser class.

[0121] S220: Obtain the class file corresponding to the class to be loaded.

[0122] In the disclosed embodiment, after acquiring the class to be loaded, the electronic device loads the class to obtain a class file corresponding to the class to be loaded.

[0123] S230: Obtain a list file corresponding to the content provider function in the class file.

[0124] In the embodiment of the present disclosure, after acquiring the class file, the electronic device acquires a list file including content provider functions in the class file.

[0125] S240, obtaining the target function in the list file.

[0126] In the embodiment of the present disclosure, after acquiring the list file, the electronic device acquires the target functions included in the list file.

[0127] S250: Register the target function based on the active thread.

[0128] In the embodiment of the present disclosure, after acquiring the target function, the electronic device registers the target function based on the active thread.

[0129] The specific implementation method is as mentioned above and will not be described again here.

[0130] Figure 3 A flow chart of a content receiver function registration method provided by an embodiment of the present disclosure is shown.

[0131] like Figure 3 As shown, the content receiver function registration method may include the following steps.

[0132] S310. Create a new target interface.

[0133] In the embodiment of the present disclosure, the electronic device may create a new target interface.

[0134] Optionally, the target interface may be an interface for implementing registration of the target function.

[0135] S320, calling the native registration method.

[0136] In the disclosed embodiment, after creating a new target interface, the electronic device may call a native registration method in the application.

[0137] S330: Obtain a list file corresponding to the content receiver function in the class file.

[0138] In the embodiment of the present disclosure, after calling the native registration method, the electronic device obtains a list file corresponding to the content receiver function in the class file.

[0139] S340, obtaining the target function file in the list.

[0140] In the embodiment of the present disclosure, after acquiring the list file, the electronic device acquires the target functions included in the list file.

[0141] S350: Register the target function based on the native registration method.

[0142] In the embodiment of the present disclosure, after acquiring the target function, the electronic device registers the target function based on the native registration method and the target interface.

[0143] The specific implementation method is as mentioned above and will not be described again here.

[0144] Combine the following Figure 4 The method for running the application provided in the embodiment of the present disclosure is exemplarily described.

[0145] Figure 4 A flowchart of another method for running an application provided by an embodiment of the present disclosure is shown.

[0146] like Figure 4 As shown, the method for running the application may include the following steps.

[0147] S410: Detecting a startup operation of an application program.

[0148] In the embodiment of the present disclosure, when a user wants to start an application in an electronic device, the user can input a start operation of the application to the electronic device, and the electronic device can detect the start operation.

[0149] S420: Detect whether there is a sub-program package to be loaded in the application program.

[0150] In the embodiment of the present disclosure, after detecting the startup operation, the electronic device may detect whether there is a sub-program package to be loaded in the application.

[0151] S430: When it is detected that a sub-program package exists in the application, load the sub-program package to obtain a first executable file corresponding to the sub-program package.

[0152] In the disclosed embodiment, after the electronic device detects whether there is a sub-program package to be loaded in the application, if it is detected that there is a sub-program package to be loaded in the application, the electronic device can load the sub-program package and obtain a first executable file corresponding to the sub-program package.

[0153] S440: Search for a second executable file corresponding to the application program.

[0154] In the embodiment of the present disclosure, after obtaining the first executable file, the electronic device may also search for a second executable file corresponding to the application program and obtain the found second executable file.

[0155] S450: Merge the first executable file with the second executable file corresponding to the application program to obtain a third executable file.

[0156] In an embodiment of the present disclosure, after obtaining the first executable file and the second executable file, the electronic device may add the first executable file to a folder of the second executable file, thereby obtaining a third executable file.

[0157] S460: Update the file name of the target class file in the third executable file to the target file name to obtain a fourth executable file.

[0158] In the embodiment of the present disclosure, after obtaining the third executable file, the electronic device may update the file name of the target class file in the third executable file to the target file name, thereby obtaining the fourth executable file.

[0159] S470: If the target function includes a content provider function, register the target function corresponding to the target class file according to the fourth executable file to run the application.

[0160] In an embodiment of the present disclosure, if the target function includes a content provider function, the electronic device may register the target function corresponding to the target class file according to the fourth executable file to run the application.

[0161] S480: If the target function includes a content receiver function, register the target function corresponding to the target class file according to the target file name.

[0162] In the embodiment of the present disclosure, if the target function includes a content receiver function, the electronic device may register the target function corresponding to the target class file according to the target file name.

[0163] Optionally, for Figure 4 The detailed description of each step is given above and will not be repeated here.

[0164] Therefore, in the embodiments of the present disclosure, it is possible to register the target function corresponding to the target class file, so that the application can run normally, thereby meeting the user's functional requirements and improving the user experience.

[0165] Figure 5 A schematic structural diagram of an electronic device provided by an embodiment of the present disclosure is shown.

[0166] The electronic devices provided by the embodiments of the present disclosure may include, but are not limited to, mobile terminals such as smart phones, laptops, PDAs, PADs, PMPs, vehicle-mounted terminals (e.g., vehicle-mounted navigation terminals), wearable devices, etc., as well as fixed terminals such as digital TVs, desktop computers, smart home devices, etc.

[0167] It should be noted that Figure 5 The electronic device 500 shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.

[0168] The electronic device 500 conventionally includes a processor 510 and a computer program product or computer-readable medium in the form of a memory 520. The memory 520 may be an electronic memory such as a flash memory, an EEPROM (electrically erasable programmable read-only memory), an EPROM, a hard disk or a ROM. The memory 520 has a storage space 521 for executable instructions (or program code) 5211 for executing any method steps of the above-mentioned note processing method. For example, the storage space 521 for executable instructions may include individual executable instructions 5211 respectively used to implement various steps in the above-mentioned note processing method. These executable instructions may be read from or written to one or more computer program products. These computer program products include program code carriers such as a hard disk, a compact disk (CD), a memory card or a floppy disk. Such a computer program product is typically a portable or fixed storage unit. The storage unit may have a storage device having a storage medium ... Figure 5 The memory 520 in the electronic device 500 is similarly arranged as a storage segment or storage space. The executable instructions can be compressed, for example, in an appropriate form. Generally, the storage unit includes executable instructions for executing the steps of the note processing method according to the present disclosure, that is, codes that can be read by a processor such as the processor 510, and when these codes are executed by the electronic device 500, the electronic device 500 executes the various steps in the note processing method described above.

[0169] Of course, to simplify, Figure 5 Only some of the components related to the present disclosure in the electronic device 500 are shown, and components such as a bus, an input / output interface, an input device, an output device, etc. are omitted. In addition, according to specific application situations, the electronic device 500 may also include any other appropriate components.

[0170] The embodiments of the present disclosure further provide a computer-readable storage medium on which computer program instructions are stored. When the computer program instructions are executed by a processor, the processor executes the method for running the application program provided by the embodiments of the present disclosure.

[0171] The computer readable storage medium can adopt any combination of one or more readable media. The readable medium can be a readable signal medium or a readable storage medium. The readable storage medium can include, for example, but is not limited to, a system, device or device of electricity, magnetism, light, electromagnetic, infrared, or semiconductor, or any combination of the above. More specific examples (non-exhaustive list) of readable storage media include: an electrical link with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.

[0172] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.

[0173] In the disclosed embodiments, program codes for performing the operations of the disclosed embodiments may be written in one or more programming languages ​​or combinations thereof, including but not limited to object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as an independent software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be linked to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be linked to an external computer (e.g., via the Internet using an Internet service provider).

[0174] The various component embodiments of the present disclosure can be implemented in hardware in all or part of the steps, or implemented in software modules running on one or more processors, or implemented in a combination thereof. It should be understood by those skilled in the art that a microprocessor or a digital signal processor (DSP) can be used in practice to implement some or all functions of some or all components in the electronic device according to the embodiments of the present disclosure. The present disclosure can also be implemented as a device or apparatus program (e.g., a computer program and a computer program product) for executing part or all of the methods described herein. Such a program implementing the present disclosure can be stored on a computer-readable medium, or can have the form of one or more signals. Such a signal can be downloaded from an Internet website, or provided on a carrier signal, or provided in any other form.

[0175] The above description is only a preferred embodiment of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solutions formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosed concept. For example, the above features are replaced with the technical features with similar functions disclosed in the present disclosure (but not limited to) by each other to form a technical solution.

[0176] In addition, although each operation is described in a specific order, this should not be understood as requiring these operations to be performed in the specific order shown or in a sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although some specific implementation details are included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Some features described in the context of a separate embodiment can also be implemented in a single embodiment in combination. On the contrary, the various features described in the context of a single embodiment can also be implemented in multiple embodiments individually or in any suitable sub-combination mode.

[0177] Although the subject matter has been described in language specific to structural features and / or methodological logical actions, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. On the contrary, the specific features and actions described above are merely example forms of implementing the claims.

Claims

1. A method for running an application, characterized in that: The method comprises: In response to detecting a startup operation on an application, loading a sub-program package in the application to obtain a first executable file corresponding to the sub-program package; Merging the first executable file with a second executable file corresponding to the application to obtain a third executable file; The file name of the target class file in the third executable file is updated to the target file name to obtain a fourth executable file, wherein the target class file is a function class file corresponding to the sub-program package, and the target file name is a file name that can be identified when the function is registered; According to the fourth executable file, register the target function corresponding to the target class file to run the application; Among them, the updating of the file name of the target class file in the third executable file to the target file name to obtain the fourth executable file includes: based on the reflection mechanism, calling the sub-program package; parsing the sub-program package to obtain a target function list in the sub-program package, the target function list including the target function; based on the target function list, updating the file name of the target class file corresponding to the target function in the third executable file to the target file name to obtain the fourth executable file.

2. The method according to claim 1, characterized in that Before loading the sub-program package in the application to obtain the first executable file corresponding to the sub-program package, the method further includes: Detecting whether the subprogram package to be loaded exists in the application program; The step of loading the sub-program package in the application program to obtain a first executable file corresponding to the sub-program package includes: When it is detected that the sub-program package exists in the application, the sub-program package is loaded to obtain a first executable file corresponding to the sub-program package.

3. The method according to claim 2, characterized in that The loading of the sub-program package to obtain a first executable file corresponding to the sub-program package includes: Download the installation package file corresponding to the subprogram package; The sub-program package is installed based on the installation package file to obtain a first executable file corresponding to the sub-program package.

4. The method according to claim 1, characterized in that: The step of merging the first executable file with the second executable file corresponding to the application to obtain a third executable file includes: Searching for a second executable file corresponding to the application program; Add the first executable file to the folder of the second executable file to obtain the third executable file.

5. The method according to claim 1, characterized in that The updating, based on the target function list, of the file name of the target class file corresponding to the target function in the third executable file to the target file name to obtain the fourth executable file comprises: Based on the target function list, determining a function name of the target function; In the third executable file, searching for the target class file having the function name; The package name in the file name of the target class file is changed from the first package name corresponding to the subprogram package to the second package name corresponding to the application program, so as to update the file name of the target class file to the target file name, and obtain the fourth executable file.

6. The method according to claim 1, characterized in that The target functions include content provider functions and / or content receiver functions.

7. The method according to claim 1, characterized in that The target function includes a content provider function, and the target class file includes a class file of the content provider function; Wherein, registering the target function corresponding to the target class file according to the fourth executable file includes: Obtaining the active thread corresponding to the target function; The target class file in the fourth executable file is called according to the target file name through the active thread to register the target function.

8. The method according to claim 1, characterized in that The target function includes a content receiver function, and the target class file includes a class file of the content receiver function; Wherein, registering the target function corresponding to the target class file according to the target file name includes: The target function corresponding to the target class file in the fourth executable file is registered through the native registration method corresponding to the application.

9. An electronic device, characterized in that: The invention comprises a processor and a memory, wherein the memory is used to store executable instructions, and the executable instructions enable the processor to perform the following operations: In response to detecting a startup operation on an application, loading a sub-program package in the application to obtain a first executable file corresponding to the sub-program package; Merging the first executable file with a second executable file corresponding to the application to obtain a third executable file; The file name of the target class file in the third executable file is updated to the target file name to obtain a fourth executable file, wherein the target class file is a function class file corresponding to the sub-program package, and the target file name is a file name that can be identified when the function is registered; According to the fourth executable file, register the target function corresponding to the target class file to run the application; When the file name of the target class file in the third executable file is updated to the target file name to obtain the fourth executable file, the executable instructions specifically cause the processor to execute: based on the reflection mechanism, calling the sub-program package; parsing the sub-program package to obtain a target function list in the sub-program package, the target function list including the target function; based on the target function list, updating the file name of the target class file corresponding to the target function in the third executable file to the target file name to obtain the fourth executable file.

10. The electronic device according to claim 9, characterized in that: Before loading the sub-program package in the application to obtain the first executable file corresponding to the sub-program package, the executable instruction further causes the processor to execute: Detecting whether the subprogram package to be loaded exists in the application program; Wherein, when the sub-program package in the application is loaded to obtain the first executable file corresponding to the sub-program package, the executable instruction specifically causes the processor to execute: When it is detected that the sub-program package exists in the application, the sub-program package is loaded to obtain a first executable file corresponding to the sub-program package.

11. The electronic device according to claim 10, characterized in that: When the sub-program package is loaded to obtain the first executable file corresponding to the sub-program package, the executable instruction specifically causes the processor to execute: Download the installation package file corresponding to the subprogram package; The sub-program package is installed based on the installation package file to obtain a first executable file corresponding to the sub-program package.

12. The electronic device according to claim 9, characterized in that: When the first executable file is merged with the second executable file corresponding to the application to obtain the third executable file, the executable instruction specifically causes the processor to execute: Searching for a second executable file corresponding to the application program; Add the first executable file to the folder of the second executable file to obtain the third executable file.

13. The electronic device according to claim 9, characterized in that: When the file name of the target class file corresponding to the target function in the third executable file is updated to the target file name based on the target function list to obtain the fourth executable file, the executable instruction specifically causes the processor to execute: Based on the target function list, determining a function name of the target function; In the third executable file, searching for the target class file having the function name; The package name in the file name of the target class file is changed from the first package name corresponding to the subprogram package to the second package name corresponding to the application program, so as to update the file name of the target class file to the target file name, and obtain the fourth executable file.

14. The electronic device according to claim 9, characterized in that: The target function includes a content provider function and / or a content receiver function.

15. The electronic device according to claim 9, characterized in that: The target function includes a content provider function, and the target class file includes a class file of the content provider function; Wherein, when registering the target function corresponding to the target class file according to the fourth executable file, the executable instruction specifically enables the processor to execute: Obtaining the active thread corresponding to the target function; The target class file in the fourth executable file is called according to the target file name through the active thread to register the target function.

16. The electronic device according to claim 9, characterized in that: The target function includes a content receiver function, and the target class file includes a class file of the content receiver function; Wherein, when registering the target function corresponding to the target class file according to the target file name, the executable instruction specifically causes the processor to execute: The target function corresponding to the target class file in the fourth executable file is registered through the native registration method corresponding to the application.

17. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed by a processor, the processor implements the method for running the application program according to any one of claims 1 to 8.