Method for extending interactive behavior and computer readable medium
By pre-building an interactive behavior capability pool in the application and setting up the hosting component to host the HTML5 page, the problem of low compatibility during iterative updates of the APP is solved, new functions are provided without updating the installation package, and the user experience is improved.
Patent Information
- Application Number
- CN202111156011.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-29
- Publication Date
- 2024-09-17
- Estimated Expiration
- 2041-09-29
AI Technical Summary
The existing hot update and hot repair framework has low compatibility during APP iterative updates and cannot meet business needs. As a result, users need to frequently update the installation package to experience new features, which affects the user experience.
Pre-build an interactive behavior capability pool in the application, set up the hosting component to host the HTML5 page, and trigger and call interactive behaviors in the interactive behavior capability pool based on user interaction events, including existing and pre-extended functions.
Provide users with new business functions and improve user experience without frequent updates and installation of new versions.
Smart Images

Figure CN114035867B
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of computer Android platforms, and in particular to a method for extending interactive behaviors and a computer-readable medium. Background Art
[0002] With the continuous iteration and update of APP, the installation package on the application market needs to be updated to add or optimize business functions. Users can experience or use new business functions only after installing the new version of the installation package. If the iteration and update are frequent, it will be very unfriendly to users. At present, the functions of some hot update and hot repair frameworks are not very mature. Either the capabilities they provide cannot meet business needs, or their mobile phone compatibility is low and they cannot achieve the expected results. Summary of the invention
[0003] The technical problem to be solved by the present invention is to provide a method for extending interactive behavior and a computer-readable medium in view of at least one defect in the prior art.
[0004] The technical solution adopted by the present invention to solve the technical problem is: constructing a method for extending interactive behavior, comprising the following steps:
[0005] S1: Pre-build an interactive behavior capability pool in the application, including multiple pre-defined interactive behaviors;
[0006] S2: pre-set the application's bearing component to bear the HTML5 page and hold the interactive behavior capability pool;
[0007] S3: The carrier component triggers the call of the corresponding interactive behavior in the interactive behavior capability pool according to the user interactive event in the HTML5 page.
[0008] Preferably, in the method for extending interactive behaviors of the present invention, the multiple interactive behaviors include existing interactive behaviors corresponding to existing business functions and extended interactive behaviors corresponding to pre-extended business functions.
[0009] Preferably, in the method for extending interactive behavior of the present invention, step S3 comprises:
[0010] The carrier component triggers the corresponding pre-extended interactive behavior in the interactive behavior capability pool according to the user interaction event of the new business function in the HTML5 page.
[0011] Preferably, in the method for extending interactive behavior of the present invention, step S1 comprises:
[0012] S11: Encapsulate a class in the application code;
[0013] S12: Create a capability pool object for this class;
[0014] S13: Write a plurality of functions corresponding to user interaction events and capable of calling corresponding functions on the terminal into the capability pool object.
[0015] Preferably, in the method for extending interactive behavior of the present invention, step S2 comprises:
[0016] The bearing component of the application is pre-set to bear the HTML5 page, and the capability pool object is injected into the JS script for event interaction of the HTML5 page.
[0017] Preferably, in the method for extending interactive behavior of the present invention, step S3 comprises:
[0018] According to the user interaction event in the HTML5 page, the capability pool object in the JS script calls the corresponding function under the object, and the function calls the corresponding function on the terminal.
[0019] Preferably, in the method for extending interactive behavior described in the present invention, event logic corresponding to user interaction events is pre-constructed in the js script, and the event logic calls the corresponding function under the object according to the capability pool object.
[0020] Preferably, in the method for extending interactive behavior of the present invention, before step S3, the method further includes:
[0021] Get user interaction events in HTML5 pages;
[0022] Determine whether there is an interactive behavior corresponding to the user interactive event in the interactive behavior capability pool, and if so, execute step S3; if not, receive the pushed new version of the application to update the interactive behavior capability pool.
[0023] Preferably, in the method for extending interactive behavior described in the present invention, the carrier component is an Activity component.
[0024] The present invention also constructs a computer-readable medium on which a computer program is stored. When the computer program is executed by a processor, the method for extending interactive behavior as described in any one of the above items is implemented.
[0025] By implementing the present invention, the following beneficial effects are achieved:
[0026] The present invention pre-builds an interactive behavior capability pool in the application, including a plurality of pre-defined interactive behaviors, and pre-sets a carrier component of the application to carry an HTML5 page and hold the interactive behavior capability pool, so that the carrier component can trigger the call of the corresponding interactive behavior in the interactive behavior capability pool according to the user interaction event in the HTML5 page, thereby providing users with new business functions and improving user experience without frequently updating and installing a new version of the application. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] The present invention will be further described below with reference to the accompanying drawings and embodiments, in which:
[0028] Figure 1 is a flow chart of a method for extending interactive behavior of the present invention;
[0029] Figure 2 It is a schematic diagram of the carrier components and interactive behavior capability pool of the present invention. DETAILED DESCRIPTION
[0030] In order to have a clearer understanding of the technical features, purposes and effects of the present invention, specific embodiments of the present invention are now described in detail with reference to the accompanying drawings.
[0031] It should be noted that the flowcharts shown in the accompanying drawings are only exemplary and do not necessarily include all the contents and operations / steps, nor do they have to be executed in the order described. For example, some operations / steps can be decomposed, while some operations / steps can be combined or partially combined, so the actual execution order may change according to actual conditions.
[0032] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities may be implemented in software form, or in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.
[0033] like Figure 1 and 2 As shown, the present invention discloses a method for extending interactive behavior, comprising the following steps:
[0034] Step S1: Pre-build an interactive behavior capability pool in the application, including multiple pre-defined interactive behaviors. The multiple interactive behaviors include existing interactive behaviors corresponding to existing business functions and extended interactive behaviors corresponding to pre-expanded business functions. In some embodiments, the existing interactive behaviors include default interactive behaviors and specific interactive behaviors. The default interactive behaviors are behaviors that are automatically triggered and called by the html5 page, while the specific interactive behaviors and extended interactive behaviors are behaviors that are triggered and called according to user interaction events in the html5 page.
[0035] In some embodiments, the multiple interactive behaviors include: taking photos, selecting photos or audio and video from the album, voice calls, video calls, payments, navigation, positioning, network connection, file acquisition, voice recognition, face recognition, gesture recognition, pupil recognition, and fingerprint recognition. For example, the default interactive behaviors include positioning and network connection. Specific interactive behaviors include taking photos, selecting photos or audio and video from the album, voice calls, video calls, and navigation; extended interactive behaviors include file acquisition, payment, voice recognition, face recognition, gesture recognition, pupil recognition, and fingerprint recognition; it should be noted that the above interactive behaviors are only examples and are not limited.
[0036] Step S2: pre-set the application's bearing component to bear the HTML5 page and hold the interactive behavior capability pool. The HTML5 page is responsible for displaying the business interface, generating user interaction events, and realizing business functions. In some embodiments, the bearing component is an Activity component.
[0037] Step S3: The carrier component triggers the corresponding interactive behavior in the interactive behavior capability pool according to the user interactive event in the HTML5 page.
[0038] Specifically, in some embodiments, the bearer component triggers the call of the corresponding existing interactive behaviors in the interactive behavior capability pool according to the user interactive events of the existing business functions in the HTML5 page, including the default interactive behaviors and the specific interactive events;
[0039] In some embodiments, the carrier component triggers the call of the corresponding pre-extended interactive behavior in the interactive behavior capability pool according to the user interaction event of the new business function in the HTML5 page.
[0040] When an application on the Android platform releases a new business function, it is generally necessary to update and install a new version of the APK package, so that the application can be updated to use the new business function. The present invention releases the new business function through an HTML5 page, and because the interactive behavior capability pool held by the carrier component pre-defines a variety of interactive behaviors, including the extended interactive behaviors corresponding to the pre-extended business functions, that is, the new business functions, the application can provide users with new business functions without frequently updating and installing new versions, thereby improving the user experience.
[0041] In some other embodiments, the method further includes step S4: the carrier component automatically triggers the call of the corresponding default interactive behavior in the interactive behavior capability pool according to the default event in the html5 page.
[0042] In this embodiment, step S1 includes:
[0043] Step S11: Encapsulate a class in the application code;
[0044] Step S12: Create a capability pool object for the class;
[0045] Step S13: Write multiple functions corresponding to user interaction events and capable of calling corresponding functions on the terminal into the capability pool object. The functions include existing interaction behavior functions and extended interaction behavior functions. The existing interaction behavior functions include default interaction behavior functions and specific interaction behavior functions.
[0046] In this embodiment, step S2 includes: setting the bearing component of the application to bear the HTML5 page, and injecting the capability pool object into the JS script for event interaction of the HTML5 page.
[0047] Correspondingly, step S3 includes: according to the user interaction event in the html5 page, the capability pool object in the js script calls the corresponding function under the object, and the function calls the corresponding function on the terminal.
[0048] In some embodiments, the event logic corresponding to the user interaction event is pre-built in the js script, and the event logic calls the corresponding function under the object according to the capability pool object, and the function calls the corresponding function on the terminal. Among them, each user interaction event corresponds to an event logic, and each event logic corresponds to a function.
[0049] In this embodiment, before step S3, the following steps are also included:
[0050] Get user interaction events in HTML5 pages;
[0051] Determine whether there is an interactive behavior corresponding to the user interactive event in the interactive behavior capability pool. If so, execute step S3; if not, receive the pushed new version of the application to update the interactive behavior capability pool. The interactive behavior capability pool will update the interactive behavior following the new version of the application.
[0052] By implementing the present invention, the following beneficial effects are achieved:
[0053] The present invention pre-builds an interactive behavior capability pool in the application, including a plurality of pre-defined interactive behaviors, and pre-sets a carrier component of the application to carry an HTML5 page and hold the interactive behavior capability pool, so that the carrier component can trigger the call of the corresponding interactive behavior in the interactive behavior capability pool according to the user interaction event in the HTML5 page, thereby providing users with new business functions and improving user experience without frequently updating and installing a new version of the application.
[0054] It can be understood that the above embodiments only express the preferred implementation modes of the present invention, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the patent scope of the present invention. It should be pointed out that, for ordinary technicians in this field, the above technical features can be freely combined without departing from the concept of the present invention, and several deformations and improvements can be made, which all belong to the protection scope of the present invention. Therefore, all equivalent changes and modifications made to the scope of the claims of the present invention should belong to the coverage of the claims of the present invention.
Claims
1. A method for extending interactive behavior, characterized in that: The following steps are involved: S1: Pre-build an interactive behavior capability pool in the application, including multiple pre-defined interactive behaviors; S2: pre-set the application's bearing component to bear the HTML5 page and hold the interactive behavior capability pool; S3: The bearing component triggers and calls the corresponding interactive behavior in the interactive behavior capability pool according to the user interactive event in the HTML5 page; Wherein, the step S1 comprises: S11: Encapsulate a class in the application code; S12: Create a capability pool object for this class; S13: writing a plurality of functions corresponding to user interaction events and capable of calling corresponding functions on the terminal into the capability pool object; The step S2 comprises: The bearing component of the application is pre-set to bear the HTML5 page, and the capability pool object is injected into the JS script for event interaction of the HTML5 page; the event logic corresponding to the user interaction event is pre-built in the JS script, and the event logic calls the corresponding function under the object according to the capability pool object; Before step S3, the following steps are also included: Get user interaction events in HTML5 pages; Determine whether there is an interactive behavior corresponding to the user interactive event in the interactive behavior capability pool, and if so, execute step S3; if not, receive a pushed new version of the application program to update the interactive behavior capability pool; The step S3 comprises: According to the user interaction event in the HTML5 page, the capability pool object in the JS script calls the corresponding function under the object, and the function calls the corresponding function on the terminal.
2. The method for extending interactive behavior according to claim 1, characterized in that: The multiple interactive behaviors include existing interactive behaviors corresponding to existing business functions and extended interactive behaviors corresponding to pre-extended business functions.
3. The method for extending interactive behavior according to claim 2, characterized in that: The step S3 comprises: The carrier component triggers the corresponding pre-extended interactive behavior in the interactive behavior capability pool according to the user interaction event of the new business function in the HTML5 page.
4. The method for extending interactive behavior according to claim 1, characterized in that: The carrier component is an Activity component.
5. A computer readable medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method for extending interactive behavior as described in any one of claims 1 to 4 is implemented.
