Communication system and method for mobile terminal extension development

By communicating with the controller one by one, the security and stability problems caused by the access party directly communicate with the controller in the mobile component development are solved, and a safe, convenient and efficient communication mode is achieved.

CN113741862BActive Publication Date: 2025-02-21BEIJING WODONG TIANJUN INFORMATION TECH CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202010897263.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-08-31
Publication Date
2025-02-21
Estimated Expiration
2040-08-31

AI Technical Summary

Technical Problem

In mobile component development, the access party directly communicates with the controller, resulting in the controller exposure, affecting the security and stability of the components, and it is difficult to distinguish whether the controller exposure method is internal to the module or an interface open to the caller.

Method used

Communication with the controller through bridge objects is established to establish a communication channel between the extension class and the controller without directly exposing the controller. The bridge objects correspond to the controller one by one to ensure the accuracy and security of communication.

Benefits of technology

It improves the security of operations and information, ensures that the extended class can communicate accurately with the page controller where it is located, solves the problem of easy communication between pages and extended class instances, and realizes a safe, convenient and efficient communication mode.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113741862B_ABST
    Figure CN113741862B_ABST
Patent Text Reader

Abstract

The present invention discloses a communication system and method for mobile terminal extension development, and relates to the field of computer technology. A specific implementation of the communication system for mobile terminal extension development includes: an extension interface, which is used to establish communication between an extension class corresponding to a mobile terminal target page and a bridge object; a bridge object, which is a communication channel between a controller and the extension class; a controller, which is used to call its corresponding controller, and there is a one-to-one correspondence between the bridge object and the controller. The communication system for mobile terminal extension development enables the extension class to communicate with the controller through the bridge object, thereby not exposing the controller to the outside; and, the bridge object and the controller correspond one-to-one, so the extension class can accurately communicate with the page controller in which it is located, thereby improving the security and convenience of communication, and making communication more efficient.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a communication system and method for mobile terminal expansion development. Background Art

[0002] Mobile terminal componentization is a hot topic nowadays. Componentization is to split the originally coupled software modules and upgrade them into components, so that each component module can break through the limitations of the original environment and flexibly serve different scenarios. In order to cope with the ever-changing personalized scenarios, components must have expansion capabilities, so it is very important to solve the communication problem between the extensions developed by the access party and the components.

[0003] like Figure 1 As shown in Figure 1, mobile client development generally adopts the MVC architecture (Model View Controller), which mainly includes three parts: M: data model, V: view, and C: controller. The extension development of the mobile terminal is mainly based on the MVC architecture, that is, the controller coordinates and controls data transmission and view status. The current extension technical solution is that the access party will communicate directly with the controller, call various methods provided by the controller, and the controller loads the views and modules developed by the access party. The main problems include: (1) The controller is the scheduling center of the entire page. If the access party is allowed to communicate directly with the controller, the controller will be exposed. The access party will find it difficult to distinguish whether the method exposed by the controller is internal to the module or an interface open to the caller; (2) The development language of mobile terminal technology is a dynamic language. If the access party is allowed to directly access the controller, it will affect the security and stability of the component; (3) Directly exposing the controller violates the principle of exposing the internal implementation as little as possible. Summary of the invention

[0004] In view of this, an embodiment of the present invention provides a communication system for mobile terminal extension development, so that the extension class communicates with the controller through a bridge object, thereby not exposing the controller to the outside, thereby improving the security of operations and information, and the bridge object and the controller correspond one-to-one, so the extension class can accurately communicate with the page controller where it is located.

[0005] To achieve the above objective, according to one aspect of an embodiment of the present invention, a communication system for mobile terminal expansion development is provided.

[0006] The communication system for mobile terminal extension development of an embodiment of the present invention includes: an extension interface, which is used to establish communication between an extension class corresponding to a mobile terminal target page and a bridge object; a bridge object, which is a communication channel between a controller and the extension class; a controller, which is used to call its corresponding controller, and there is a one-to-one correspondence between the bridge object and the controller.

[0007] Optionally, the extended class includes an identification attribute, and the value of the identification attribute is the bridge object.

[0008] Optionally, the controller is further configured to assign the bridge object to an identification attribute of the extension class when creating an instance of the extension class.

[0009] Optionally, the bridge object comprises a forwarding extension, and the forwarding extension is used to forward a method call on the bridge object to the controller.

[0010] Optionally, the permission of the forwarding extension is hidden, and the permission of the bridge object is exposed.

[0011] Optionally, the controller is further used to create a corresponding bridge object, and / or to bind the bridge object corresponding to the controller to the instance of the extended class.

[0012] To achieve the above objective, according to another aspect of an embodiment of the present invention, a communication method for mobile terminal extension development is provided.

[0013] The communication method for mobile terminal extension development of an embodiment of the present invention includes: establishing communication between the extension class corresponding to the mobile terminal target page and the bridge object; based on the bridge object, calling its corresponding controller, wherein the bridge object and the controller correspond one to one.

[0014] Optionally, the step of establishing communication between the extension class corresponding to the mobile terminal target page and the bridge object includes: when creating an instance of the extension class, assigning the bridge object to the identification attribute of the extension class to establish communication between the extension class and the bridge object.

[0015] Optionally, based on the bridge object, the step of calling its corresponding controller includes: determining a forwarding extension of the bridge object; and forwarding a method call on the bridge object to the controller based on the forwarding extension.

[0016] Optionally, the permission of the forwarding extension is hidden, and the permission of the bridge object is exposed.

[0017] Optionally, before assigning the bridge object to the identification attribute of the extended class, the method further includes: creating a bridge object corresponding to the controller; and / or binding the bridge object corresponding to the controller to an instance of the extended class.

[0018] To achieve the above objective, according to another aspect of an embodiment of the present invention, an electronic device is provided.

[0019] The electronic device of an embodiment of the present invention includes: one or more processors; a storage device for storing one or more programs, when the one or more programs are executed by the one or more processors, the one or more processors implement any of the above-mentioned communication methods for mobile terminal extension development.

[0020] To achieve the above-mentioned purpose, according to another aspect of an embodiment of the present invention, a computer-readable medium is provided, on which a computer program is stored, characterized in that when the program is executed by a processor, any of the above-mentioned communication methods for mobile terminal expansion development is implemented.

[0021] One embodiment of the above invention has the following advantages or beneficial effects:

[0022] (1) The extension class communicates with the controller through a bridge object, thereby not exposing the controller to the outside world, thereby improving the security of operations and information;

[0023] (2) A controller corresponds to a bridge object, which serves as a channel for communication with the outside world. Everything is scheduled by the controller. The controller is equivalent to the concept of a page. For one-to-many and many-to-one design scenarios, for example, when an app is running, it may open multiple product detail pages. When the extension class communicates with the page, it can accurately obtain and call the current page. Since the bridge object and the controller correspond one-to-one, the extension class can accurately communicate with the page controller it is in. This solves the problem that in an app, the communication between the page and the extension class instance is prone to confusion;

[0024] (3) Add attribute extensions to the extended class and assign the bridge object to the attribute of the extended class. In addition, because the attributes added by the bridge object are ubiquitous through the extension of the base class, the extended class does not need to introduce any additional files, and the bridge object can be obtained within the class, thus achieving efficient acquisition of the bridge object;

[0025] (4) The extended class communicates directly with the bridge object, and the bridge object forwards the method implementation to the controller, while the controller remains hidden and invisible to the outside world. In addition, since it is just forwarding, there is almost no cost, so the bridge object can be used to arbitrarily control the methods exposed to the outside world, which is very flexible.

[0026] (5) Bridge object creation, message forwarding, extension class loading, and the binding of extension classes and bridge objects are all completed within the SDK and are invisible to the outside world. The only thing the outside world can access is the bridge object, and the acquisition of the bridge object and the calling of methods are all implemented within the SDK. The only thing the outside party needs to do is to develop their own extensions, and when they need to communicate with the page controller, they can obtain their own bridge object properties and call the methods of the properties. This ensures that the communication mode is safe, convenient, and efficient.

[0027] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with the specific implementation manner. BRIEF DESCRIPTION OF THE DRAWINGS

[0028] The accompanying drawings are used to better understand the present invention and do not constitute an improper limitation of the present invention.

[0029] Figure 1 This is a schematic diagram of the MVC architecture;

[0030] Figure 2 is a schematic diagram of the main parts of a communication system developed for mobile terminal extension according to an embodiment of the present invention;

[0031] Figure 3 is a schematic diagram of a communication system developed by a mobile terminal according to an embodiment of the present invention;

[0032] Figure 4 It is a schematic diagram of the main process of the communication method for mobile terminal extension development according to an embodiment of the present invention;

[0033] Figure 5 is a schematic diagram of a communication method for mobile terminal extension development according to an embodiment of the present invention;

[0034] Figure 6 is an exemplary system architecture diagram to which embodiments of the present invention may be applied;

[0035] Figure 7 It is a schematic diagram of the structure of a computer system of a terminal device or a server suitable for implementing an embodiment of the present invention. DETAILED DESCRIPTION

[0036] The following is a description of exemplary embodiments of the present invention in conjunction with the accompanying drawings, including various details of the embodiments of the present invention to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and conciseness, the description of well-known functions and structures is omitted in the following description.

[0037] Some technical terms included in the embodiments of the present invention are explained as follows:

[0038] Class: Objects with the same attributes are called classes. They are a collection of attributes and methods that encapsulate data and operations on these data. For example: car, person, dog, god;

[0039] Object: An object is an instance of a class, a variable of class type. For example, a bulldozer is an instantiation of a car; Zhang San is an instantiation of a person; Xiao Bai (the name of a dog) is an instantiation of a dog; classes and objects are the most basic concepts in object-oriented programming technology;

[0040] Attributes: Attributes are used to describe the characteristics of a specific object and are static. For example: Zhang San is more than 1.6 meters tall; Xiao Bai's hair is brown; Erlang Shen has an eye on his forehead; and the attribute value can be any data type or an object;

[0041] Methods: Each object has its own behavior or methods of using it, such as a dog can run and bark, etc. These behaviors are called methods, which are dynamic and can be used to operate an object;

[0042] SDK Software Development Kit: A collection of files that simply provide an application programming interface for a programming language, but may also include complex hardware that can communicate with an embedded system. Common tools include utilities for debugging and other purposes. SDKs also often include sample code, supporting technical notes, or other supporting documents that clarify questions for basic reference materials;

[0043] MVC: Model View Controller, is the abbreviation of Model-View-Controller, a software design paradigm that organizes code in a way that separates business logic, data, and interface display, and aggregates business logic into one component. It does not need to rewrite business logic while improving and personalizing the interface and user interaction.

[0044] Figure 2 is a schematic diagram of a communication system developed by a mobile terminal according to an embodiment of the present invention, such as Figure 2 As shown, the communication system 200 for mobile terminal extension development according to the embodiment of the present invention mainly includes a bridge object 201 , a controller 202 , and an extension interface 204 .

[0045] The bridge object 201 is a communication channel between the controller 202 and the extension class 203. The extension class 203 communicates with the bridge object 201, and the bridge object 201 calls the controller 202, so the bridge object serves as a communication channel between the controller 202 and the extension class 203.

[0046] The controller 202, the bridge object 201 is used to call its corresponding controller 202. And, there is a one-to-one correspondence between the bridge object 201 and the controller 202.

[0047] The extension interface 204 is used to establish communication between the extension class 203 corresponding to the mobile terminal target page and the bridge object 201 .

[0048] Traditional mobile terminal development is mainly based on the MVC architecture, in which the controller coordinates and controls data transmission and view status. The technical solution of the prior art extension is that the access party will communicate directly with the controller, the access party calls various methods provided by the controller, and the controller loads the views and modules developed by the access party. If the access party is allowed to call the controller directly, many properties of the controller may be tampered with, some shortcuts may be abused, and then the component security and stability may be affected, causing some app crash problems. Based on the embodiment of the present invention, the extension class communicates with the controller through a bridge object, and the controller is not exposed to the outside. In addition, the bridge object and the controller correspond one-to-one, so the extension class can accurately communicate with the page controller in which it is located. When the mobile SDK provides external services and provides the access party with personalized development capabilities, it is very important to build a safe and concise communication model. The communication system of the embodiment of the present invention solves the problems existing in the above-mentioned prior art and makes communication safe, convenient and efficient.

[0049] In an embodiment of the present invention, the extended class includes an identification attribute, and the value of the identification attribute is a bridge object. The controller is also used to assign the bridge object to the identification attribute of the extended class when creating an instance of the extended class. In object-oriented language development, there is a concept of inheritance, that is, the capabilities of the base class can be inherited by the subclass. Taking iOS development as an example, in the iOS development language environment, all classes are inherited from the base class of NSObject at their roots, and an attribute bridgeObject (i.e., an identification attribute) is added to the base class of this NSObject, and the identification attribute is the created bridge object class type. The technology of adding attributes to the base class adopts the category extension technology, which is a feature supported by the language itself, and the technology is not described in detail in the embodiment of the present invention. In short, after adding an attribute bridgeObject to the base class of NSObject, any class can call the bridgeObject attribute anywhere. And because the attributes of this bridge object are ubiquitous through the extension of the base class, the extended class does not need to introduce any additional files, and the bridge object can be obtained inside the class. After adding an identification attribute to the extension class and creating a bridge object, the controller assigns the bridge object to the identification attribute of the extension class. This solves the problem of assigning the bridge object. When the external extension class calls its own attributes, it can normally obtain the bridge object.

[0050] In an embodiment of the present invention, the bridge object includes a forwarding extension, and the forwarding extension is used to forward the method call of the bridge object to the controller. Optionally, the permission of the forwarding extension is hidden, and the permission of the bridge object is exposed. Among them, the permission of hidden means that the outside world cannot obtain it, and the permission of exposed means that the outside world can obtain it.

[0051] Since the controller and the bridge object are in a one-to-one relationship and can communicate directly with each other, in the embodiment of the present invention, the bridge object can directly call the controller's method. Since the bridge object directly calls the controller's method and also references the controller, it will cause the controller to be exposed. Therefore, in another embodiment of the present invention, the method of adding an extension to the NSObject base class is similar. Instead of directly allowing the bridge object to reference the controller, an extension is added to the bridge object (i.e., forwarding extension), and a reference to the page controller is added to the extension. This extension is hidden in the SDK and cannot be exposed to the outside world. The advantage of this is that the outside caller cannot see that the bridge object references the controller at all. As mentioned above, the extension technology is a feature supported by the language itself, and the embodiment of the present invention will not describe this technology in detail. The outside world directly communicates with the bridge object and forwards the method call to the bridge object to the controller, while the controller is still hidden and invisible to the outside world. Moreover, since it is just forwarding, there is almost no cost, so the method of external exposure can be arbitrarily controlled by the bridge object, which is very flexible.

[0052] In an embodiment of the present invention, the controller is also used to create its corresponding bridge object. The bridge object corresponding to the controller is bound to the instance of the extension class. Designed for one-to-many and many-to-one relationships, just as an app may open multiple business detail pages, the extension class needs to accurately communicate with the page instance it is in. For the embodiment of the present invention: the controller creates a bridge object that is in a one-to-one relationship with itself, creates an instance of the extension class at the same time, and binds the bridge object and the instance of the extension class one by one, so when the extension class communicates with the page controller through the bridge object, it must be the page it is in. In this way, in an app, no matter how many instances of pages and extension classes there are, communication will not be confused.

[0053] Based on the embodiment of the present invention, the creation of the bridge object of the page, message forwarding, extension class loading, and binding of the extension class and the bridge object are all completed inside the SDK and are invisible to the outside world. The only thing the outside world can access is the bridge object, and the acquisition of the bridge object and the calling of the method are all implemented inside the SDK. The only thing the outside access party needs to do is to develop its own extension, and when it needs to communicate with the page controller, it can obtain its own bridge object properties and call the method of the property. Therefore, the communication mode of the embodiment of the present invention is safe, convenient, and efficient.

[0054] Mobile terminal componentization is a hot topic nowadays. Componentization, as the name implies, is to split the various software modules that were originally coupled together and upgrade them into components, so that each component module can break through the limitations of the original environment and flexibly apply to serve different scenarios. Many large enterprises are practicing componentization, and there are many such cases. For example, the takeaway component of Meituan Takeaway serves Meituan app and Meituan Takeaway app; JD's e-commerce transaction process serves JD app, Jingxi app, JD Health app, etc. (only as an example). Among them, the various service apps mentioned in the examples of the embodiments of the present invention are only for the purpose of fully illustrating the embodiments of the present invention. They do not have any directional meaning and do not involve the disclosure of information of each app. On the one hand, componentization avoids repeated development and greatly reduces enterprise costs. At the same time, component reuse shortens the software delivery cycle and improves the company's ability to respond quickly to the market. Finally, component reuse can also provide a unified and consistent user experience on various platforms.

[0055] However, componentization technology also has many challenges. Since it serves the business, the ever-changing business and market needs do not require a component with completely identical functions. For example, a company has developed a set of transaction process components, in which the product details module is to be reused in various apps. The popular group-buying e-commerce app may want to add the group-buying process to the product details module, while the medical and health app may want to add the relevant process of medicine. Therefore, componentization encounters the following challenges: it is necessary to maintain the reusability of the components and to be able to cope with the ever-changing personalized scenarios. Therefore, componentization is also an idealized goal, which is difficult to quantify and has no ultimate perfect form. This is also a classic problem often encountered in software development and design, and even in computer science, and solutions are sought in trade-offs and balances.

[0056] In order to cope with ever-changing personalized scenarios, components must have the ability to expand. For example, for mobile apps, it allows the access party to develop customized processes as component extensions. As in the above example, group buying apps and medical and health apps are based on the same component. According to the unified interface opened by the component, each develops its own business extension, and the component will load the extension implemented by the access party to achieve the purpose of displaying their own different businesses. Therefore, there is another problem: how does the extension developed by the access party communicate with the component?

[0057] Mobile client development, whether it is iOS or Android, generally adopts the MVC architecture. Data and views are scheduled by the controller, and the controller is responsible for specific display and interaction scheduling, such as obtaining data and passing data related to a view to the view for display. In the MVC architecture of the mobile client, the controller C represents a specific page, such as the shopping cart page has a shopping cart controller, and the product details page has a product details controller. The data model M represents the data, and the view V is responsible for display, content, copywriting or pictures, etc. For the componentization of the mobile terminal, if the access party needs to add views to the page or call the page method, since the page is uniformly scheduled by the controller, the access party needs to communicate with the controller and accept the unified scheduling of the controller.

[0058] Figure 3 Schematic diagram of a communication system developed by a mobile terminal according to an embodiment of the present invention; Figure 3 As shown, the bridge object is used as a transit station, a bridge, a pipeline, connecting two components for communication. The components are used by the access party, and the access party develops its own things, and the developed things are extended instances. In addition, when using an e-commerce app, you can open the product page. There is usually a recommendation position under the product. Clicking the recommended product can also enter a new product page, and so on. At this time, your app contains multiple product pages, and each page is an instance. Every time an instance of a page is created, a bridge object and an extended instance will be created in response. The one-to-one communication does not interfere with each other, avoiding the extension of product A running to product B page, avoiding the situation where product A clicks Add to Cart and product B is added to the shopping cart, etc.

[0059] The communication system based on the embodiment of the present invention can realize that when the mobile SDK communicates with external extensions, the key controllers and complex logic inside the SDK are hidden, and a simple interface is exposed to the outside. Regarding the concept of SDK, for example, a component is a product details module, which is provided to others for secondary development and extension. Others want to add a button to this page, and click this button to add to the shopping cart. This method of adding to the shopping cart is provided by the product details module and must be exposed to the outside. This is the concept of SDK.

[0060] In addition, the embodiment of the present invention also constructs a communication pipeline with the external extension class, allowing the external extension class to communicate with the SDK controller through the pipeline in an extremely low-cost manner. The communication pipeline of the embodiment of the present invention can freely control the capabilities and methods of SDK exposure to the outside world, which is also a low-cost method. Based on the application prospects of componentization in the industry, it greatly reduces the cost for enterprises, and the support of the embodiment of the present invention for extensions also improves the customization capabilities of components to cope with different scenarios when reused, and has great practical value.

[0061] In the embodiment of the present invention, the first step is to create a bridge object to replace the controller and communicate with the outside world. Therefore, the methods to be exposed to the outside world need to be concentrated in a protocol. This protocol has different names in different programming languages ​​and environments, some are called interfaces, some are called protocols, etc. It represents a specification, a virtual method declaration, rather than a specific method implementation; once a class declares that it complies with a certain protocol, it needs to implement the protocol method.

[0062] Create a bridge object and make it comply with the protocol. The interface exposed to the outside is no longer the controller, but the bridge object, so that the access party can make method calls through the bridge object.

[0063] The second step is to implement the extension class of the access party and obtain the bridge object, that is, to establish the communication between the extension class corresponding to the mobile target page and the bridge object through the extension interface. In object-oriented language development, there is a concept of inheritance, that is, the capabilities of the base class can be inherited by the subclass. Taking iOS development as an example, in the iOS development language environment, all classes are inherited from the base class of NSObject at their root. A property bridgeObject is added to the base class of NSObject, which is the bridge object class type created in the first step. Specifically, everything in object-oriented is a class and an object. A class is an abstract concept, a whole. For example, a car is an abstract concept, a whole, a class. Every real car you see is a car object, and an object is an entity. Attributes are also the basic concept of object-oriented language development. For example, the car class, the car door can be understood as its attribute, and the tire is also its attribute. In addition, tires can also be classes (abstract concepts), and the corresponding specific tires you actually see are objects (entities). In addition, classes provide attributes and methods to the outside world, such as door opening methods and start methods.

[0064] For example, when air conditioners were first invented, they were used to dissipate heat in a machine in a large factory. The air conditioner did not have a switch control panel, but all the line control logic was coupled with the line switch of the large machine. At this time, the air conditioner can be understood as a heat dissipation component of a large machine. Later, the air conditioner can be extracted from the large machine and provided to other types of machines. However, the circuit, switch, and control structure of the air conditioner are too complicated. In order to make it easy for other machines to access it, the complex circuit and control logic can be hidden inside the machine, and only a few simple methods are exposed to the outside, such as opening, closing, and setting the temperature. Therefore, these simple methods provided to the outside can be integrated into a separate switch control panel. This switch control panel can be understood as a bridge object, and the switch control panel can be understood as an attribute of the air conditioner. For each air conditioner that provides heat dissipation to other machines, a switch control panel must be produced and installed on the air conditioner (assigning attributes). Other machines get this switch control panel and interact according to the protocol. For example, the first button is the opening method, the second button is the closing method, and the protocol can be understood as a product instruction manual.

[0065] The specific technology used to add attributes to the base class is a technology called category extension, which is a feature supported by the language itself. After adding an attribute bridgeObject to the base class of NSObject, any class can call the bridgeObject attribute anywhere, so the problem of obtaining the bridge object is solved by adding attributes to the base class. In addition, the extended class does not need to introduce any additional files, and the bridge object can be obtained within the class, because through the extension of the base class, the attributes of this bridge object are ubiquitous. However, attributes need to be assigned before they can be used, otherwise an empty object is obtained, which is meaningless; this step only solves the way to obtain the bridge object, and the following solves the problem of creating and assigning this bridge object.

[0066] Through the above steps, a basic and simple communication mode has been built. Through basic extension, the extension class can obtain the bridge object in the form of its own attribute call, and then make specific method calls through the bridge object and the relevant protocols to achieve communication with the page.

[0067] The third step uses message forwarding to solve the problem of how the bridge object specifically implements the method of the protocol to be followed. In the embodiment of the present invention, a page will create a bridge object as a channel for communication with the outside world, and everything is scheduled by the controller. The controller is equivalent to the concept of the page, and what is exposed to the outside is the bridge object. The bridge object does not have to rewrite the method logic implemented in the controller, but can call the method of the page controller to implement it when implementing the specific method of the protocol. The calling method is relatively simple. Since the page and the bridge object are in a one-to-one relationship, they can communicate directly with each other, and the bridge object can directly call the method of the controller. However, the bridge object will also reference the controller, which will cause the controller to be exposed. Therefore, in the embodiment of the present invention, similar to the method of adding an extension to the NSObject base class, the bridge object does not directly reference the controller, but adds an extension to the bridge object, and adds a reference to the page controller in the extension, and this extension must be hidden in the SDK and cannot be exposed to the outside. Therefore, the external caller cannot see that the bridge object references the controller at all. The outside world communicates directly with the bridge object, and the bridge object implements the method and forwards it to the controller, while the controller is still hidden and invisible to the outside world. Also, since it is just forwarding, there is almost no cost, so the method of external exposure can be arbitrarily controlled through the bridge object, which is very flexible. This process is called message forwarding.

[0068] The fourth step is to solve the problem in the second step. Although the bridge object extension is added to the base class, the attribute needs to be assigned in advance before it can be used. When the page loads the external extension class, it will create an instance of the external extension class, also called an object, which is a basic concept in object-oriented language development. After the page loads and creates an instance of the external extension class, it will assign the bridge object that has a one-to-one relationship with itself to the attribute of the external extension class. The basis of this assignment is the content of the second and third steps. Specifically, first add attribute extensions to the extension class; secondly, create a bridge object; then the page assigns the bridge object to the attribute of the extension class. This solves the problem of bridge object assignment. When the external extension class calls its own attribute, it can normally obtain the bridge object. This also solves the one-to-many and many-to-one relationship design mentioned above. As in the example above, an app may open multiple business detail pages, and the extension class needs to accurately communicate with the page instance it is in. The technical solution of the present invention ensures this: the page is responsible for creating a bridge object that is in a one-to-one relationship with itself, and at the same time creating an instance of the extension class, and binding the bridge object and the instance of the extension class one by one, so when the extension class communicates with the page controller through the bridge object, it must be the page it is in. In this way, in an app, no matter how many instances of pages and extension classes there are, communication will not be confused.

[0069] According to an embodiment of the present invention, the creation of the bridge object of the page, message forwarding, extension class loading, and binding of the extension class and the bridge object are all completed inside the SDK and are invisible to the outside world. The only thing the outside world can access is the bridge object, and the acquisition of the bridge object and the calling of methods are all implemented inside the SDK. All the outside access party needs to do is to develop its own extension, and when it needs to communicate with the page controller, it can obtain its own bridge object properties and call the method of the property. This perfectly solves the problems mentioned above, and this communication mode is safe, convenient and efficient.

[0070] Figure 4 is a schematic diagram of a communication method for mobile terminal extension development according to an embodiment of the present invention, such as Figure 4 As shown, the communication method for mobile terminal extension development in an embodiment of the present invention mainly includes:

[0071] Step S401: establishing communication between the extension class corresponding to the mobile terminal target page and the bridge object.

[0072] Step S402: Based on the bridge object, call its corresponding controller, wherein there is a one-to-one correspondence between the bridge object and the controller.

[0073] Figure 5 Schematic diagram of a communication method for mobile terminal extension development according to an embodiment of the present invention; Figure 5 As shown, in an embodiment of the present invention, in the process of establishing communication between the extension class corresponding to the mobile terminal target page and the bridge object, when creating an instance of the extension class, the bridge object is assigned to the identification attribute of the extension class to establish communication between the extension class corresponding to the mobile terminal target page and the bridge object. Based on the bridge object, in the process of calling its corresponding controller, the forwarding extension of the bridge object is determined. Based on the forwarding extension, the method call to the bridge object is forwarded to the controller. Optionally, the permission of the forwarding extension is hidden, and the permission of the bridge object is exposed. Before assigning the bridge object to the identification attribute of the extension class, create a bridge object corresponding to the controller. And / or, bind the bridge object corresponding to the controller to the instance of the extension class.

[0074] According to the embodiments of the present invention, the following advantages or beneficial effects are achieved:

[0075] (1) The extension class communicates with the controller through a bridge object, thereby not exposing the controller to the outside world, thereby improving the security of operations and information;

[0076] (2) A controller corresponds to a bridge object, which serves as a channel for communication with the outside world. Everything is scheduled by the controller. The controller is equivalent to the concept of a page. For one-to-many and many-to-one design scenarios, for example, when an app is running, it may open multiple product detail pages. When the extension class communicates with the page, it can accurately obtain and call the current page. Since the bridge object and the controller correspond one-to-one, the extension class can accurately communicate with the page controller it is in. This solves the problem that in an app, the communication between the page and the extension class instance is prone to confusion;

[0077] (3) Add attribute extensions to the extended class and assign the bridge object to the attribute of the extended class. In addition, because the attributes added by the bridge object are ubiquitous through the extension of the base class, the extended class does not need to introduce any additional files, and the bridge object can be obtained within the class, thus achieving efficient acquisition of the bridge object;

[0078] (4) The extended class communicates directly with the bridge object, and the bridge object forwards the method implementation to the controller, while the controller remains hidden and invisible to the outside world. In addition, since it is just forwarding, there is almost no cost, so the bridge object can be used to arbitrarily control the methods exposed to the outside world, which is very flexible.

[0079] (5) Bridge object creation, message forwarding, extension class loading, and the binding of extension classes and bridge objects are all completed within the SDK and are invisible to the outside world. The only thing the outside world can access is the bridge object, and the acquisition of the bridge object and the calling of methods are all implemented within the SDK. The only thing the outside party needs to do is to develop their own extensions, and when they need to communicate with the page controller, they can obtain their own bridge object properties and call the methods of the properties. This ensures that the communication mode is safe, convenient, and efficient.

[0080] Figure 6 An exemplary system architecture 600 is shown to which the communication method for mobile terminal extension development or the communication system for mobile terminal extension development according to the embodiments of the present invention can be applied.

[0081] like Figure 6 As shown, system architecture 600 may include terminal devices 601, 602, 603, network 604 and server 605. Network 604 is used to provide a medium for communication links between terminal devices 601, 602, 603 and server 605. Network 604 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.

[0082] Users can use terminal devices 601, 602, and 603 to interact with server 605 through network 604 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 601, 602, and 603, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (only examples).

[0083] The terminal devices 601 , 602 , and 603 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, and desktop computers, etc.

[0084] Server 605 may be a server that provides various services, such as a backend management server (only an example) that provides support for shopping websites browsed by users using terminal devices 601, 602, and 603. The backend management server may analyze and process the received data such as product information query requests, and feed back the processing results to the terminal device.

[0085] It should be noted that the communication method for mobile terminal extension development provided in the embodiment of the present invention is generally executed by the server 605 , and accordingly, the communication system for mobile terminal extension development is generally set in the server 605 .

[0086] It should be understood that Figure 6 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.

[0087] Reference below Figure 7 , which shows a schematic diagram of the structure of a computer system 700 of a terminal device suitable for implementing an embodiment of the present invention. Figure 7 The terminal device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.

[0088] like Figure 7 As shown, the computer system 700 includes a central processing unit (CPU) 701, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 702 or a program loaded from a storage part 708 into a random access memory (RAM) 703. In the RAM 703, various programs and data required for the operation of the system 700 are also stored. The CPU 701, the ROM 702, and the RAM 703 are connected to each other via a bus 704. An input / output (I / O) interface 705 is also connected to the bus 704.

[0089] The following components are connected to the I / O interface 705: an input section 706 including a keyboard, a mouse, etc.; an output section 707 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 708 including a hard disk, etc.; and a communication section 709 including a network interface card such as a LAN card, a modem, etc. The communication section 709 performs communication processing via a network such as the Internet. A drive 710 is also connected to the I / O interface 705 as needed. A removable medium 711, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 710 as needed, so that a computer program read therefrom is installed into the storage section 708 as needed.

[0090] In particular, according to the embodiments disclosed in the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present invention include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 709, and / or installed from the removable medium 711. When the computer program is executed by the central processing unit (CPU) 701, the above-mentioned functions defined in the system of the present invention are executed.

[0091] It should be noted that the computer-readable medium shown in the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer 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. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.

[0092] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0093] The modules involved in the embodiments of the present invention may be implemented in software or hardware. The modules described may also be set in a processor, for example, it may be described as: a processor includes an acquisition controller and a bridge object. The names of these modules do not constitute a limitation on the modules themselves in some cases, for example, a controller may also be described as "used to call its corresponding controller".

[0094] As another aspect, the present invention further provides a computer-readable medium, which may be included in the device described in the above embodiment; or may exist independently without being assembled into the device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by a device, the device includes: establishing communication between the extension class corresponding to the mobile terminal target page and the bridge object; based on the bridge object, calling its corresponding controller, wherein the bridge object and the controller correspond one to one.

[0095] According to the embodiment of the present invention, the extension class communicates with the controller through the bridge object, thereby not exposing the controller to the outside, thereby improving the security of operation and information. In addition, the bridge object and the controller correspond one-to-one, so the extension class can accurately communicate with the page controller in which it is located.

[0096] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A communication system for mobile terminal expansion development, characterized in that: include: Extension interface, used to establish communication between the extension class corresponding to the mobile target page and the bridge object; A bridge object, the bridge object being a communication channel between the controller and the extension class; A controller, wherein the bridge object is used to call its corresponding controller, and there is a one-to-one correspondence between the bridge object and the controller; Wherein, an identification attribute is added to the base class of the extension class in advance so that the extension class inherits the identification attribute, and the identification attribute of the extension class is assigned to the bridge object so that the extension class obtains the bridge object by calling its own identification attribute.

2. The communication system according to claim 1, characterized in that The bridge object includes a forwarding extension for forwarding a method call on the bridge object to the controller.

3. The communication system according to claim 2, characterized in that: The permission of the forwarding extension is hidden, and the permission of the bridge object is exposed.

4. The communication system according to any one of claims 1 to 3, characterized in that: The controller is also used to create a corresponding bridge object, and / or bind the bridge object corresponding to the controller to the instance of the extended class.

5. A communication method for mobile terminal extension development, characterized in that: include: Establish communication between the extension class corresponding to the mobile target page and the bridge object; Based on the bridge object, calling its corresponding controller, wherein there is a one-to-one correspondence between the bridge object and the controller; The step of establishing communication between the extension class corresponding to the mobile terminal target page and the bridge object includes: when creating an instance of the extension class, assigning the bridge object to the identification attribute of the extension class, so that the extension class obtains the bridge object by calling its own identification attribute, thereby establishing communication between the extension class and the bridge object; the identification attribute of the extension class is inherited from the base class of the extension class, and the base class of the extension class is pre-added with the identification attribute.

6. The communication method according to claim 5, characterized in that: Based on the bridge object, the steps of calling its corresponding controller include: determining a forwarding extension of the bridge object; Based on the forwarding extension, method calls on the bridge object are forwarded to the controller.

7. The communication method according to claim 6, characterized in that: The permission of the forwarding extension is hidden, and the permission of the bridge object is exposed.

8. The communication method according to any one of claims 5 to 7, characterized in that: Before assigning the bridge object to the identification attribute of the extension class, it also includes: Creating a bridge object corresponding to the controller; and / or binding the bridge object corresponding to the controller to an instance of the extended class.

9. An electronic device, characterized in that: include: one or more processors; A storage device, used to store one or more programs, when the one or more programs are executed by the one or more processors, enables the one or more processors to implement the communication method as described in any one of claims 5-8.

10. A computer readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the communication method according to any one of claims 5 to 8 is implemented.