CN109032684B - Android system based broadcast plug-in implementation method and terminal - Google Patents

Android system based broadcast plug-in implementation method and terminal Download PDF

Info

Publication number
CN109032684B
CN109032684B CN201710436203.9A CN201710436203A CN109032684B CN 109032684 B CN109032684 B CN 109032684B CN 201710436203 A CN201710436203 A CN 201710436203A CN 109032684 B CN109032684 B CN 109032684B
Authority
CN
China
Prior art keywords
bundle
broadcast
file
bundle file
version number
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201710436203.9A
Other languages
Chinese (zh)
Other versions
CN109032684A (en
Inventor
孙向作
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
TCL Technology Group Co Ltd
Original Assignee
TCL Technology Group Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by TCL Technology Group Co Ltd filed Critical TCL Technology Group Co Ltd
Priority to CN201710436203.9A priority Critical patent/CN109032684B/en
Publication of CN109032684A publication Critical patent/CN109032684A/en
Application granted granted Critical
Publication of CN109032684B publication Critical patent/CN109032684B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44521Dynamic linking or loading; Link editing at or after load time, e.g. Java class loading
    • G06F9/44526Plug-ins; Add-ons
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates

Abstract

The embodiment of the invention discloses a method and a terminal for realizing broadcasting plug-in based on an android system, wherein the method comprises the following steps: acquiring a broadcasted bundle configuration file from a cloud end, wherein the bundle configuration file at least comprises a version number, a symbol name and a download address of the bundle file; inquiring whether a bundle file matched with the symbol name of the bundle file is stored in a local database or not according to the symbol name of the bundle file in the bundle configuration file; if so, judging whether the version number of the bundle file is smaller than the version number of the bundle file in the bundle configuration file; if yes, downloading the latest broadcast bundle file according to the download address of the bundle file in the bundle configuration file; and installing and starting the latest broadcast bundle file, and updating the local database. The embodiment of the invention can realize the dynamic update of the plug-in of the broadcast sender by regenerating the bundle file corresponding to the new broadcast sender when the key value or the content of the broadcast is required to be changed, does not need to synchronously modify the applications corresponding to the broadcast sender and the broadcast receiver, and has higher efficiency.

Description

Android system based broadcast plug-in implementation method and terminal
Technical Field
The invention relates to the technical field of intelligent terminals, in particular to a broadcast plug-in implementation method based on an android system and a terminal.
Background
In the android system, a function similar to a broadcast station is provided, and a common event can be sent to other applications as a broadcast message, and the event message can be received as long as the other applications specify the name of the received event. It can be concluded that if a broadcast is desired, there are two parts to transmit and receive. Common broadcast events are: the method comprises the following steps of externally dialing a phone, receiving a short message, completing startup, plugging and unplugging an SD card, installing, uninstalling and upgrading software, changing electric quantity and the like, and when an application program receives the events through broadcasting, different things can be made according to different time.
At present, inter-process communication is realized through broadcasting, a broadcast sender and a broadcast receiver need to define a broadcast event and a key value for broadcast sending in advance, the broadcast sender sends broadcast content on the broadcast event according to the key value, and the broadcast receiver obtains the broadcast content on the broadcast event according to the key value sent by the broadcast sender. In the actual broadcasting process, if the requirement is changed, for example, broadcast content is increased and transmitted, a new key value is needed, and at this time, applications corresponding to a broadcast sender and a broadcast receiver need to be modified synchronously, especially when there are applications of multiple broadcast receivers, which results in large modification workload and low efficiency.
Disclosure of Invention
The embodiment of the invention provides a method and a terminal for realizing broadcasting plug-in based on an android system, aiming at solving the problems that in the actual broadcasting process, if the requirement is changed, for example, broadcast content is increased and sent, a new key value is needed, the corresponding applications of a broadcast sender and a broadcast receiver need to be modified synchronously, and especially when the applications of a plurality of broadcast receivers exist, the modification workload is large and the efficiency is low
In a first aspect, an embodiment of the present invention provides a method for implementing a broadcast plug-in based on an android system, where the method includes:
acquiring a broadcasted bundle configuration file from a cloud, wherein the bundle configuration file at least comprises a version number of the bundle file, a symbol name of the bundle file and a download address of the bundle file;
inquiring whether a local database stores a bundle file matched with the symbol name of the bundle file or not according to the symbol name of the bundle file in the bundle configuration file;
if so, judging whether the version number of the bundle file is smaller than the version number of the bundle file in the bundle configuration file;
if the broadcast content is less than the preset broadcast content, downloading the latest broadcast bundle file according to the download address of the bundle file in the bundle configuration file;
and installing and starting the latest broadcast bundle file, and updating the local database.
In a second aspect, an embodiment of the present invention provides a terminal, where the terminal includes:
the device comprises an acquisition unit, a storage unit and a processing unit, wherein the acquisition unit is used for acquiring a broadcast bundle configuration file from a cloud end, and the bundle configuration file at least comprises a version number of the bundle file, a symbol name of the bundle file and a download address of the bundle file;
the query unit is used for querying whether the bundle file matched with the symbol name of the bundle file is stored in a local database or not according to the symbol name of the bundle file in the bundle configuration file;
the judging unit is used for judging whether the version number of the bundle file is smaller than the version number of the bundle file in the bundle configuration file or not if the version number of the bundle file is smaller than the version number of the bundle file in the bundle configuration file;
the download unit is used for downloading the latest broadcast bundle file according to the download address of the bundle file in the bundle configuration file if the download address is smaller than the download address;
and the updating unit is used for installing and starting the latest broadcast bundle file and updating the local database.
In a third aspect, an embodiment of the present invention provides another terminal, including a processor, an input device, an output device, and a memory, where the processor, the input device, the output device, and the memory are connected to each other, where the memory is used to store an application program code that supports the terminal to execute the foregoing method, and the processor is configured to execute the foregoing method according to the first aspect.
In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, in which a computer program is stored, the computer program comprising program instructions, which, when executed by a processor, cause the processor to perform the method of the first aspect.
The method comprises the steps that a broadcast bundle configuration file is obtained from a cloud end, wherein the bundle configuration file at least comprises a version number of the bundle file, a symbol name of the bundle file and a download address of the bundle file; inquiring whether a local database stores a bundle file matched with the symbol name of the bundle file or not according to the symbol name of the bundle file in the bundle configuration file; if so, judging whether the version number of the bundle file is smaller than the version number of the bundle file in the bundle configuration file; if the broadcast content is less than the preset broadcast content, downloading the latest broadcast bundle file according to the download address of the bundle file in the bundle configuration file; and installing and starting the latest broadcast bundle file, and updating the local database, so that when the key value or the content of the broadcast needs to be changed and sent, the dynamic update of the plug-in of the broadcast sender can be realized only by regenerating the bundle file corresponding to the new broadcast sender, the synchronous modification of the applications corresponding to the broadcast sender and the broadcast receiver is not needed, and the efficiency is high.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a schematic flowchart of an implementation method based on an android system broadcast plug-in according to an embodiment of the present invention;
fig. 2 is a schematic flowchart of an implementation method based on an android system broadcast plug-in according to an embodiment of the present invention;
fig. 3 is a schematic flowchart of an implementation method based on an android system broadcast plug-in according to an embodiment of the present invention;
fig. 4 is a schematic block diagram of a terminal according to an embodiment of the present invention;
fig. 5 is a schematic block diagram of a terminal according to an embodiment of the present invention;
fig. 6 is a schematic block diagram of a terminal according to an embodiment of the present invention;
fig. 7 is a schematic block diagram of a terminal according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It will be understood that the terms "comprises" and/or "comprising," when used in this specification and the appended claims, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
It is also to be understood that the terminology used in the description of the invention herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. As used in the specification of the present invention and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise.
It should be further understood that the term "and/or" as used in this specification and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.
As used in this specification and the appended claims, the term "if" may be interpreted contextually as "when", "upon" or "in response to a determination" or "in response to a detection". Similarly, the phrase "if it is determined" or "if a [ described condition or event ] is detected" may be interpreted contextually to mean "upon determining" or "in response to determining" or "upon detecting [ described condition or event ]" or "in response to detecting [ described condition or event ]".
In particular implementations, the terminals described in embodiments of the invention include, but are not limited to, other portable devices such as mobile phones, laptop computers, or tablet computers having touch sensitive surfaces (e.g., touch screen displays and/or touch pads). It should also be understood that in some embodiments, the device is not a portable communication device, but is a desktop computer having a touch-sensitive surface (e.g., a touch screen display and/or touchpad).
In the discussion that follows, a terminal that includes a display and a touch-sensitive surface is described. However, it should be understood that the terminal may include one or more other physical user interface devices such as a physical keyboard, mouse, and/or joystick.
The terminal supports various applications, such as one or more of the following: a drawing application, a presentation application, a word processing application, a website creation application, a disc burning application, a spreadsheet application, a gaming application, a telephone application, a video conferencing application, an email application, an instant messaging application, an exercise support application, a photo management application, a digital camera application, a web browsing application, a digital music player application, and/or a digital video player application.
Various applications that may be executed on the terminal may use at least one common physical user interface device, such as a touch-sensitive surface. One or more functions of the touch-sensitive surface and corresponding information displayed on the terminal can be adjusted and/or changed between applications and/or within respective applications. In this way, a common physical architecture (e.g., touch-sensitive surface) of the terminal can support various applications with user interfaces that are intuitive and transparent to the user.
The implementation method and the terminal for the broadcasting plug-in based on the android system provided by the embodiment of the invention relate to OSGI and bundle files in the specific implementation, and the OSGI and the bundle files are introduced below.
The OSGI is a dynamic model system facing JAVA, and an OSGI service platform consists of two parts: OSGI framework and OSGI standard services. The OSGI framework is a runtime environment that implements and provides OSGI functionality, and OSGI standard services define many reusable APIs for performing common tasks. The specification of the OSGI framework and standard services is managed by the OSGI alliance. The OSGI framework plays a central role in creating OSGI-based applications because it is the execution environment of the application.
The OSGI alliance defines the correct behavior of the framework in the OSGI framework specification so that it can be programmed based on a well-defined API. This framework is designed according to three conceptual layers defined in the OSGI specification:
module layer: focus is on packaging and sharing code. The module layer defines the concept of OSGI module and refers to it as a bundle. A bundle is a jar file containing metadata (data about data) consisting of class files and related resources. Which are logical modules that make up a particular application.
Life cycle layer: focus is on providing execution time module management and access to the underlying OSGI framework. The lifecycle layer defines how dynamically installed and managed in the OSGI framework. The lifecycle layer defines the operations of the bundle lifecycle. These lifecycle operations allow applications to be dynamically provisioned, managed and improved in a well-defined manner.
And (3) a service layer: attention is directed to the interaction and communication between modules, and in particular the components within the modules. The service layer supports and facilitates a flexible application programming model. The service-oriented publishing, searching and binding interaction mode is mainly related, namely, a service provider publishes a service to a service registry, and then a service client searches for available services by searching the service registry.
bundle is a module model in OSGI. The class file and the corresponding resource file are contained in the jar package of the standard Java platform, and the bundle can be simply understood as the jar package added with metadata. A bundle contains java class and some other data resources, such as HTML files, help documents, icons, etc.
For ease of description, the modules are understood to be: a set of logically encapsulated implementation classes, an optional public API based on a subset of the implementation classes, and a set of dependencies on external code.
The bundle can be understood as a function module from the user layer. A bundle can import and export from a project and can share jar files with other bundles in the project. The bundle provides services for the OSGI framework, and is the only entity to be deployed in the OSGI service framework. Once a bundle starts running, it will provide functions and services to other bundles in the framework through the OSGI framework.
Convenient description the bundle is understood as: a modular physical unit contains code, resources and metadata in the form of jar files, where the boundaries of jar files also serve as encapsulation boundaries for the logical modules at execution time.
The OSGI framework runs on a Java virtual machine, the Bundle can be understood as an application program executed on the OSGI framework, and the Service provides an import and export interface for the Bundle. The Bundle can be automatically installed and executed on the OSGI framework after being downloaded from the server, and registers the required services and the provided services with the OSGI platform.
When the relevant codes of the broadcast sender in the Android system are written, the jar package is generated by compiling in the integrated development environment, and the bundle file is loaded in the OSGI platform. The broadcast bundle file in this proposal refers to a broadcast sender in the broadcast.
Referring to fig. 1, it is a schematic flowchart of an implementation method for providing a broadcast plug-in based on an android system according to an embodiment of the present invention, where the method is a flow of sending a broadcast when a broadcast sender communicates with a broadcast receiver application. As shown in fig. 1, the method may include:
step S101, acquiring a broadcast bundle configuration file from a cloud, wherein the bundle configuration file at least comprises a version number of the bundle file, a symbol name of the bundle file and a download address of the bundle file.
Preferably, in this embodiment, when the broadcast sender starts broadcasting the bundle file, the terminal is triggered to acquire the broadcast bundle configuration file from the cloud. Each broadcast corresponds to a bundle configuration file, and the bundle configuration file further comprises a broadcast sending key value group and a broadcast event name. In one specific application, the formats of the bundle profiles of three different broadcasts are as follows:
Figure BDA0001317405890000061
step S102, inquiring whether a bundle file matched with the symbol name of the bundle file is stored in a local database or not according to the symbol name of the bundle file in the bundle configuration file, and if so, entering step S203; otherwise, directly downloading a new broadcast bundle file according to the bundle file downloading address in the bundle configuration file, then installing and starting the new broadcast bundle file, and updating the database.
Preferably, in this embodiment, after acquiring the bundle configuration file, the terminal may analyze the bundle configuration file to acquire a symbol name, a version number, and a download address of the bundle file in the bundle configuration file; and then inquiring whether the local database of the terminal stores the bundle file matched with the name of the bundle file according to the analyzed symbol name of the bundle file in the bundle configuration file.
Preferably, in this embodiment, the local database stores bundle file information installed on the android system, where the bundle file information at least includes a version number and a symbol name of the installed bundle file. The inquiring whether the bundle file matched with the symbol name of the bundle file is stored in a local database of the terminal according to the analyzed matching name of the bundle file in the bundle configuration file comprises:
inquiring whether a bundle file with the same symbol name as the bundle file in the bundle configuration file is stored in a local database of the terminal or not according to the symbol name of the bundle file in the bundle configuration file;
if so, the bundle file is the bundle file matched with the symbol name of the bundle file in the bundle configuration file; otherwise, it is indicated that the bundle file matched with the symbol name of the bundle file in the bundle configuration file is not stored in the local database of the terminal.
Step S103, judging whether the version number of the bundle file is smaller than the version number of the bundle file in the bundle configuration file; if yes, the step S104 is executed; otherwise, the flow ends.
Preferably, in this embodiment, if the version number of the bundle file is smaller than the version number of the bundle file in the bundle configuration file, it indicates that the version of the broadcast bundle file stored in the local database is low and needs to be updated, and then step S104 is performed; otherwise, it indicates that the broadcast bundle file stored in the local database is the latest version, and does not need to be updated, and the process is ended at this time.
And step S104, downloading the latest broadcast bundle file according to the download address of the bundle file in the bundle configuration file.
And step S105, installing and starting the latest broadcast bundle file, and updating the local database.
Preferably, in this embodiment, the broadcast bundle file stored in the local database is installed and updated by calling the sendecontext of the OSGI framework embedded in the android system, and calling the install () and start () methods.
As can be seen from the above, according to the implementation method of the broadcast plug-in based on the android system, the broadcast bundle configuration file is acquired from the cloud, and the bundle configuration file at least includes the version number of the bundle file, the symbol name of the bundle file, and the download address of the bundle file; inquiring whether a local database stores a bundle file matched with the symbol name of the bundle file or not according to the symbol name of the bundle file in the bundle configuration file; if so, judging whether the version number of the bundle file is smaller than the version number of the bundle file in the bundle configuration file; if the broadcast content is less than the preset broadcast content, downloading the latest broadcast bundle file according to the download address of the bundle file in the bundle configuration file; and installing and starting the latest broadcast bundle file, and updating the local database, so that when the key value or the content of the broadcast needs to be changed and sent, the dynamic update of the plug-in of the broadcast sender can be realized only by regenerating the bundle file corresponding to the new broadcast sender, the synchronous modification of the applications corresponding to the broadcast sender and the broadcast receiver is not needed, and the efficiency is high.
Fig. 2 is a schematic flowchart of an implementation method based on an android system broadcast plug-in according to an embodiment of the present invention. Referring to fig. 2, in comparison with the previous embodiment, the implementation method of the android system broadcast plugin provided in this embodiment further includes, before the triggering terminal acquires the broadcast bundle configuration file from the cloud:
and step S201, embedding an OSGI framework in the android system.
In the OSGI service platform, a life cycle layer consists of three core interfaces, namely Bundle, Bundle context and Bundle activator. The lifecycle layer core part in the OSGI framework embedded in the Android system still consists of the three interfaces, but the methods in the interfaces need to be deleted and expanded. The reason for deleting is that the methods cannot be used in the frame of the Android platform, and redundant methods are deleted to make the frame lighter. Meanwhile, a new method is required to be added, so that the interface can acquire some specific attributes of the Android platform module.
The Bundle interface represents a Bundle that has been installed into the framework to allow state operations to be performed on it.
Each Bundle entity in the OSGI framework corresponds to a Bundle object, and the Bundle object is an abstraction of the Bundle entity. Each Bundle corresponds to a unique and life-cycle invariant ID number assigned by the framework. The method for acquiring the basic information of the Bundle defined in the Bundle interface comprises the following steps: acquiring a state, acquiring a version, acquiring an ID (identity), and the like, and further defines a Bundle management method, which comprises the following steps: update, unload, start, stop, etc.
The BundleContext interface provides a way for applications to operate the OSGI framework when executed.
BundleContext refers to the context of a module running in a framework, which provides a way for the module to interact with the framework. When a module is started, the framework creates a corresponding BundleContext object, but the object cannot be transmitted between the modules, which is to ensure the safety of the modules and the correct allocation of resources.
For convenience of description, the proposal refers to embedding the OSGI framework in the Android system as OSGI framework. The OsgiFramework is realized as an Android system service, namely Servie. The method comprises the following steps:
for convenience of description, Bundle refers to a Bundle file, and Bundle refers to an OSGI framework interface.
1. And realizing the Service of running the OSGI framework, such as establishing a Service (Service) inherited by the GetFramework from the Android.
For convenience of description, the service is called GetFrameworkService, the service is completed, and the service is added into the system service through a service manager ServiceManager in the Android system. Thus, the getframeworkserviceservice is started up as the system service is started up each time the system is started up.
2. The OSGI framework instance is obtained in the service, and the framework instance is obtained by the frameworkfactory. When a frame instance is obtained, the frame instance is started, for example, by a framework.
In the above, the getframeworkserviceservice is started in the Android system, and through the Android system binder mechanism, a proxy of the getframeworkserviceservice, such as GetFrameworkServiceProxy, is provided to the application layer, and through the OSGI framework service proxy, a relevant interface in the getframeworkserviceservice, such as an acquisition framework instance interface, can be accessed.
Step S202, starting the OSGI framework to acquire a BundleContext interface.
In this embodiment, step S202 specifically includes:
and acquiring the OSGI frame example through a proxy GetFrameworkServiceProxy of the GetFrameworkService service. Such as the getframeworklnstance () method.
Getboundlecontext () method obtains the BundleContext by calling framework.
Step S203, compiling the source code of the broadcast sender into jar files, and converting the jar files into bundle files.
The following describes a process of generating a broadcast bundle file:
as can be seen from the foregoing description, a bundle file is a jar file to which specific metadata is added, and therefore, to convert a jar file compiled from source code of a broadcast sender into a bundle file, corresponding metadata needs to be added to the jar file, where the metadata includes: readable information, bundle identification information, and code visibility information.
Readable information: and providing the related help information of the bundle for the user. Examples may include:
Bundle-Name: as an abbreviated name for bundle files;
Bundle-Description: describing the function of the bundle file;
Bundle-DocURL: providing a document related to the bundle file;
Bundle-Category: defining a set of category names separated by commas;
Bundle-Vendor: information about the bundle provider;
Bundle-ContactAddress: information about the bundle provider;
bundle-copy: information about the bundle provider;
bundle file identification information: identifying necessary information of the bundle file;
each bundle file installed in the OSGI framework must have a unique identifier, which consists of both the symbol name and the bundle version number of the bundle file.
The Bundle-SymbolincName is the symbolic name of Bundle file, which is consistent with the naming method of java package, and can directly adopt the package name as the symbolic name.
The Bundle-Version, i.e. Bundle Version number, and the format of the Bundle file Version number agreed by the OSGI specification is as follows: major version number, minor version number, micro version number, qualifier.
Bundle-Manifestversion: the OSGI framework determines which version of OSGI specification is adopted to process the bundle file according to the metadata information
Code visibility information: necessary information defining which codes are visible internally and which codes are visible externally;
Export-Package: exporting an internal code, namely an internal bundle package separated by commas and disclosed for sharing with other bundle files;
image-Package: and importing external codes, and importing a group of packages which are required by the internal bundle codes, come from other bundle files and are separated by commas.
Specifically, the metadata can be added into the META-INF/MANIFEST. MF entry of the jar file and converted into a bundle file by utilizing a BndTools plug-in of eclipse, jar commands and a bnd tool, wherein the bnd tool is developed by related personnel responsible for OSGI technology and provides a large number of command lines specially designed for OSGI.
And step S204, installing the bundle file through the BundleContext interface.
In this embodiment, the bundle file is installed by calling a bundle context. Wherein the parameter location is the bundle file storage path. When the installation is successful, the Bundle ID (Bundle IDentifier) of the installed Bundle is returned. Bundle ID is the most common identifier used at runtime. It is a long integer number automatically assigned by the OSGI framework that does not change throughout the Bundle lifecycle (including after Bundle update, uninstall) and even remains after the OSGI framework is restarted. The Bundle ID is distributed from small to large by the OSGI framework in the Bundle installation process according to the sequence of Bundle installation time.
Step S205, acquiring the information of the bundle file installed in the android system, and storing the information of the bundle file in the local database; the bundle file information at least includes a symbol name and a version number of the mounted bundle file.
Preferably, in this embodiment, the Bundle file information may further include a Bundle ID of the Bundle file, a Bundle file package name, a broadcast event name, and a broadcast sending key attribute.
Preferably, in this embodiment, the terminal may obtain the ID of the current Bundle by calling a getboundleid () method of the Bundle that is successfully installed and returned; and respectively acquiring the symbol name and the version number of the Bundle by calling the getSymbolincName () method and getVersion () method of the Bundle.
Step S206, the broadcast sender is controlled to start the bundle.
Step S207, acquiring a broadcasted bundle configuration file from the cloud, where the bundle configuration file at least includes a version number of the bundle file, a symbol name of the bundle file, and a download address of the bundle file.
Step S208, inquiring whether a bundle file matched with the symbol name of the bundle file is stored in a local database according to the symbol name of the bundle file in the bundle configuration file; if yes, the process proceeds to step S209.
Step S209, judging whether the version number of the bundle file is smaller than the version number of the bundle file in the bundle configuration file; if so, the process proceeds to step S210.
And step S210, if the current broadcast bundle file is smaller than the preset broadcast bundle file, downloading the latest broadcast bundle file according to the download address of the bundle file in the bundle configuration file.
And step S211, installing and starting the latest broadcast bundle file, and updating the local database.
It should be noted that, in this embodiment, the implementation manners of step S207 to step S211 are completely the same as the implementation manners of step S101 to step S105 in the embodiment shown in fig. 1, and therefore, no further description is given here.
Therefore, it can be seen that the implementation method for the broadcasting plug-in based on the android system, which is provided by the embodiment, can implement dynamic update of the broadcasting sender plug-in only by regenerating a new bundle file corresponding to a broadcasting sender when a key value or a content of a broadcast needs to be changed and sent, does not need to perform synchronous modification on applications corresponding to the broadcasting sender and a broadcasting receiver, and is high in efficiency.
Fig. 3 is an implementation method of a broadcast plug-in based on the android system according to an embodiment of the present invention. Referring to fig. 3, with respect to the previous embodiment, the implementation method for a broadcast plug-in based on an android system provided in this embodiment further includes, after the installing and starting the latest broadcast bundle file, updating the local database:
step S312, controlling the broadcast sender and the broadcast receiver to communicate according to a preset interface protocol, where the preset interface protocol includes an input part and an output part, where the input part defines input parameters including a broadcast event name and a broadcast key value of the broadcast sender, and the output part defines a state of an execution result of the called broadcast component, that is, broadcast content.
Preferably, in this embodiment, when the broadcast sender application and the broadcast receiver application perform inter-application communication, a basic flow of acquiring broadcast content at the broadcast receiver application end is as follows:
acquiring bundle of all broadcast senders in a local database;
inputting the name of the broadcast event to a broadcast sender, and acquiring the corresponding bundle in the previous step according to the name of the broadcast event in the input parameters
Obtaining the key value of the bundle found in the previous step
Inputting a key value to a broadcast sender to obtain broadcast content; if the key value is input, the broadcast content corresponding to the key value is returned, and if the key value is not input, the broadcast content corresponding to all the broadcast key values is returned in a key value-broadcast content mode.
For convenience of description, it is assumed here that a broadcast to be received by a certain broadcast receiver application is a broadcast sender application with a channel identification function, when receiving the broadcast, a broadcast event name of the broadcast sender is input according to a predefined interface protocol, a broadcast sender with a channel identification function and a key value thereof are obtained, and then a broadcast content is obtained by inputting a key value, for example, a key value of an identified current channel name is input, and a broadcast content corresponding to the key value, for example, an actually identified channel name, is obtained.
It should be noted that, in this embodiment, the implementation processes of step S301 to step S311 are completely the same as the implementation processes of step S201 to step S211 in the previous embodiment, and therefore, no further description is given here.
Therefore, it can be seen that, according to the implementation method of the broadcast plugin based on the android system provided in this embodiment, when a key value or a content of a broadcast needs to be changed and sent, dynamic update of the broadcast sender plugin can be achieved only by regenerating a new bundle file corresponding to a broadcast sender, and synchronous modification of applications corresponding to the broadcast sender and a broadcast receiver is not needed, so that efficiency is high.
Fig. 4 is a schematic block diagram of a terminal according to an embodiment of the present invention, and only a part related to the embodiment is shown for convenience of description.
Referring to fig. 4, the present embodiment provides a terminal 100, including:
the acquiring unit 11 is configured to acquire a broadcast bundle configuration file from a cloud, where the bundle configuration file at least includes a version number of the bundle file, a symbol name of the bundle file, and a download address of the bundle file;
the query unit 12 is configured to query whether a bundle file matched with the symbol name of the bundle file is stored in a local database according to the symbol name of the bundle file in the bundle configuration file;
a determining unit 13, configured to determine whether the version number of the bundle file is smaller than the version number of the bundle file in the bundle configuration file if the version number of the bundle file is smaller than the version number of the bundle file;
the downloading unit 14 is configured to, if the size is smaller than the preset size, download the latest broadcast bundle file according to the download address of the bundle file in the bundle configuration file;
and the updating unit 15 is configured to install and start the latest broadcast bundle file, and update the local database.
Optionally, the bundle configuration file further includes a broadcast key value group and a broadcast event name.
Optionally, referring to fig. 5, in an embodiment of the present invention, the terminal 100 further includes:
an embedding unit 16, configured to embed an OSGI framework in the android system;
an interface unit 17, configured to start the OSGI framework to obtain a BundleContext interface;
the conversion unit 18 is used for compiling the source code of the broadcast sender into jar files and converting the jar files into bundle files;
an installation unit 19, configured to install the bundle file through the BundleContext interface;
the storage unit 20 is used for acquiring the bundle file information installed in the android system and storing the bundle file information to the local database; the bundle file information at least includes a symbol name and a version number of the mounted bundle file.
Optionally, referring to fig. 6, in an embodiment of the present invention, the terminal 100 further includes:
a control unit 21, configured to control a broadcast sender and a broadcast receiver to communicate according to a preset interface protocol, where the preset interface protocol includes an input part and an output part, where the input part defines input parameters including a broadcast event name and a broadcast key value of the broadcast sender, and the output part defines a state of an execution result of a called broadcast component, that is, broadcast content.
It should be noted that, since each unit in the terminal provided in the embodiment of the present invention is based on the same concept as that of the embodiment of the method of the present invention, the technical effect brought by the unit is the same as that of the embodiment of the method of the present invention, and specific contents may refer to descriptions in the embodiment of the method of the present invention, and are not described herein again.
Therefore, it can be seen that, when a key value or a content of a broadcast needs to be changed, the terminal provided in this embodiment can implement dynamic update of a plug-in of a broadcast sender only by regenerating a new bundle file corresponding to the broadcast sender, and does not need to perform synchronous modification on applications corresponding to the broadcast sender and the broadcast receiver, which is high in efficiency.
Fig. 7 is a schematic block diagram of a terminal according to an embodiment of the present invention. The terminal 100 in the present embodiment as shown in the figure may include: one or more processors 701; one or more input devices 702, one or more output devices 703, and memory 704. The processor 701, the input device 702, the output device 703, and the memory 704 are connected by a bus 705. The memory 702 is used for storing instructions and the processor 701 is used for executing the instructions stored by the memory 702. Wherein the processor 701 is configured to:
acquiring a broadcasted bundle configuration file from a cloud, wherein the bundle configuration file at least comprises a version number of the bundle file, a symbol name of the bundle file and a download address of the bundle file;
inquiring whether a local database stores a bundle file matched with the symbol name of the bundle file or not according to the symbol name of the bundle file in the bundle configuration file;
if so, judging whether the version number of the bundle file is smaller than the version number of the bundle file in the bundle configuration file;
if the broadcast content is less than the preset broadcast content, downloading the latest broadcast bundle file according to the download address of the bundle file in the bundle configuration file;
and installing and starting the latest broadcast bundle file, and updating the local database.
Optionally, the processor 701 is further configured to:
embedding an OSGI framework in an android system;
starting the OSGI framework to acquire a BundleContext interface;
compiling the source code of a broadcast sender into a jar file, and converting the jar file into a bundle file;
installing the bundle file through the BundleContext interface;
acquiring the information of the bundle file installed in the android system, and storing the information of the bundle file in the local database; the bundle file information at least includes a symbol name and a version number of the mounted bundle file.
Optionally, the processor 701 is further configured to:
the method comprises the steps of controlling a broadcast sender and a broadcast receiver to communicate according to a preset interface protocol, wherein the preset interface protocol comprises an input part and an output part, the input part defines input parameters comprising a broadcast event name and a broadcast key value of the broadcast sender, and the output part defines the state of an execution result of a called broadcast component, namely broadcast content.
Optionally, the bundle configuration file further includes a broadcast key value group and a broadcast event name.
It should be understood that, in the embodiment of the present invention, the Processor 701 may be a Central Processing Unit (CPU), and the Processor may also be other general processors, Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs) or other Programmable logic devices, discrete Gate or transistor logic devices, discrete hardware components, etc. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The input device 702 may include a touch pad, a fingerprint sensor (for collecting fingerprint information of a user and direction information of the fingerprint), a microphone, etc., and the output device 703 may include a display (LCD, etc.), a speaker, etc.
The memory 704 may include both read-only memory and random-access memory, and provides instructions and data to the processor 701. A portion of the memory 704 may also include non-volatile random access memory. For example, the memory 704 may also store device type information.
In a specific implementation, the processor 701, the input device 702, and the output device 703 described in this embodiment of the present invention may execute the implementation described in the method embodiments shown in fig. 1 to fig. 3 provided in this embodiment of the present invention, and may also execute the implementation of the terminal described in this embodiment of the present invention, which is not described herein again.
In another embodiment of the invention, a computer-readable storage medium is provided, storing a computer program which, when executed by a processor, implements:
acquiring a broadcasted bundle configuration file from a cloud, wherein the bundle configuration file at least comprises a version number of the bundle file, a symbol name of the bundle file and a download address of the bundle file;
inquiring whether a local database stores a bundle file matched with the symbol name of the bundle file or not according to the symbol name of the bundle file in the bundle configuration file;
if so, judging whether the version number of the bundle file is smaller than the version number of the bundle file in the bundle configuration file;
if the broadcast content is less than the preset broadcast content, downloading the latest broadcast bundle file according to the download address of the bundle file in the bundle configuration file;
and installing and starting the latest broadcast bundle file, and updating the local database.
Optionally, the computer program when executed by the processor implements:
embedding an OSGI framework in an android system;
starting the OSGI framework to acquire a BundleContext interface;
compiling the source code of a broadcast sender into a jar file, and converting the jar file into a bundle file;
installing the bundle file through the BundleContext interface;
acquiring the information of the bundle file installed in the android system, and storing the information of the bundle file in the local database; the bundle file information at least includes a symbol name and a version number of the mounted bundle file.
Optionally, the computer program when executed by the processor implements:
the method comprises the steps of controlling a broadcast sender and a broadcast receiver to communicate according to a preset interface protocol, wherein the preset interface protocol comprises an input part and an output part, the input part defines input parameters comprising a broadcast event name and a broadcast key value of the broadcast sender, and the output part defines the state of an execution result of a called broadcast component, namely broadcast content.
Optionally, the bundle configuration file further includes a broadcast key value group and a broadcast event name.
The computer readable storage medium may be an internal storage unit of the terminal according to any of the foregoing embodiments, for example, a hard disk or a memory of the terminal. The computer readable storage medium may also be an external storage device of the terminal, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like provided on the terminal. Further, the computer-readable storage medium may also include both an internal storage unit and an external storage device of the terminal. The computer-readable storage medium is used for storing the computer program and other programs and data required by the terminal. The computer readable storage medium may also be used to temporarily store data that has been output or is to be output.
Those of ordinary skill in the art will appreciate that the elements and algorithm steps of the examples described in connection with the embodiments disclosed herein may be embodied in electronic hardware, computer software, or combinations of both, and that the components and steps of the examples have been described in a functional general in the foregoing description for the purpose of illustrating clearly the interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
It can be clearly understood by those skilled in the art that, for convenience and brevity of description, the specific working processes of the terminal and the unit described above may refer to corresponding processes in the foregoing method embodiments, and are not described herein again.
In the several embodiments provided in the present application, it should be understood that the disclosed terminal and method can be implemented in other manners. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the units is only one logical division, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may also be an electric, mechanical or other form of connection.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment of the present invention.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention essentially or partially contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product stored in a storage medium and including instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
While the invention has been described with reference to specific embodiments, the invention is not limited thereto, and various equivalent modifications and substitutions can be easily made by those skilled in the art within the technical scope of the invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims (6)

1. An implementation method based on android system broadcast plug-in is characterized by comprising the following steps:
acquiring a broadcasted bundle configuration file from a cloud, wherein the bundle configuration file at least comprises a version number of the bundle file, a symbol name of the bundle file, a download address of the bundle file, a broadcast sending key value group and a broadcast event name;
inquiring whether a local database stores a bundle file matched with the symbol name of the bundle file or not according to the symbol name of the bundle file in the bundle configuration file;
if so, judging whether the version number of the bundle file is smaller than the version number of the bundle file in the bundle configuration file;
if the broadcast content is less than the preset broadcast content, downloading the latest broadcast bundle file according to the download address of the bundle file in the bundle configuration file;
installing and starting the latest broadcast bundle file, and updating the local database;
controlling a broadcast sender and a broadcast receiver to communicate according to a preset interface protocol, wherein the preset interface protocol comprises an input part and an output part, the input part defines input parameters comprising a broadcast event name and a broadcast key value of the broadcast sender, and the output part defines the state of an execution result of a called broadcast component;
when the broadcast sender application and the broadcast receiver application perform inter-application communication, the basic flow of the broadcast receiver application end for acquiring the broadcast content is as follows:
a1, acquiring bundle of all broadcast senders in a local database;
a2, inputting the name of the broadcast event to the broadcast sender, and acquiring the corresponding bundle in the bundle in A1 according to the name of the broadcast event in the input parameters;
a3, acquiring the key value of the bundle found in A2;
a4, inputting key values to the broadcast sender to obtain broadcast contents; if the key value is input, the broadcast content corresponding to the key value is returned, and if the key value is not input, the broadcast content corresponding to all the broadcast key values is returned in a key value-broadcast content mode.
2. The method for implementing the android system broadcast plug-in according to claim 1, wherein the obtaining the broadcasted first bundle configuration file from the cloud further comprises:
embedding an OSGI framework in an android system;
starting the OSGI framework to acquire a BundleContext interface;
compiling the source code of a broadcast sender into a jar file, and converting the jar file into a bundle file;
installing the bundle file through the BundleContext interface;
acquiring the information of the bundle file installed in the android system, and storing the information of the bundle file in the local database; the bundle file information at least includes a symbol name and a version number of the mounted bundle file.
3. A terminal, comprising:
the device comprises an acquisition unit, a processing unit and a processing unit, wherein the acquisition unit is used for acquiring a broadcast bundle configuration file from a cloud end, and the bundle configuration file at least comprises a version number of the bundle file, a symbol name of the bundle file, a download address of the bundle file, a broadcast sending key value group and a broadcast event name;
the query unit is used for querying whether the bundle file matched with the symbol name of the bundle file is stored in a local database or not according to the symbol name of the bundle file in the bundle configuration file;
the judging unit is used for judging whether the version number of the bundle file is smaller than the version number of the bundle file in the bundle configuration file or not if the version number of the bundle file is smaller than the version number of the bundle file in the bundle configuration file;
the download unit is used for downloading the latest broadcast bundle file according to the download address of the bundle file in the bundle configuration file if the download address is smaller than the download address;
the updating unit is used for installing and starting the latest broadcast bundle file and updating the local database;
the system comprises a control unit, a broadcast component and a broadcast receiver, wherein the control unit is used for controlling the broadcast sender and the broadcast receiver to communicate according to a preset interface protocol, the preset interface protocol comprises an input part and an output part, the input part defines input parameters comprising a broadcast event name and a broadcast key value of the broadcast sender, and the output part defines the state of an execution result of a called broadcast component;
when the broadcast sender application and the broadcast receiver application perform inter-application communication, the basic flow of the broadcast receiver application end for acquiring the broadcast content is as follows:
a1, acquiring bundle of all broadcast senders in a local database;
a2, inputting the name of the broadcast event to the broadcast sender, and acquiring the corresponding bundle in the bundle in A1 according to the name of the broadcast event in the input parameters;
a3, acquiring the key value of the bundle found in A2;
a4, inputting key values to the broadcast sender to obtain broadcast contents; if the key value is input, the broadcast content corresponding to the key value is returned, and if the key value is not input, the broadcast content corresponding to all the broadcast key values is returned in a key value-broadcast content mode.
4. The terminal of claim 3, further comprising:
the embedding unit is used for embedding the OSGI framework in the android system;
the interface unit is used for starting the OSGI framework to acquire a BundleContext interface;
the conversion unit is used for compiling the source code of the broadcast sender into a jar file and converting the jar file into a bundle file;
the installation unit is used for installing the bundle file through the BundleContext interface;
the storage unit is used for acquiring the information of the bundle file installed in the android system and storing the information of the bundle file to the local database; the bundle file information at least includes a symbol name and a version number of the mounted bundle file.
5. A terminal comprising a processor, an input device, an output device and a memory, the processor, the input device, the output device and the memory being interconnected, wherein the memory is configured to store application program code and the processor is configured to invoke the program code to perform the method of claim 1 or 2.
6. A computer-readable storage medium, characterized in that the computer storage medium stores a computer program comprising program instructions that, when executed by a processor, cause the processor to carry out the method according to claim 1 or 2.
CN201710436203.9A 2017-06-09 2017-06-09 Android system based broadcast plug-in implementation method and terminal Active CN109032684B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710436203.9A CN109032684B (en) 2017-06-09 2017-06-09 Android system based broadcast plug-in implementation method and terminal

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710436203.9A CN109032684B (en) 2017-06-09 2017-06-09 Android system based broadcast plug-in implementation method and terminal

Publications (2)

Publication Number Publication Date
CN109032684A CN109032684A (en) 2018-12-18
CN109032684B true CN109032684B (en) 2020-11-10

Family

ID=64629342

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710436203.9A Active CN109032684B (en) 2017-06-09 2017-06-09 Android system based broadcast plug-in implementation method and terminal

Country Status (1)

Country Link
CN (1) CN109032684B (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103034789A (en) * 2012-12-10 2013-04-10 山东中创软件商用中间件股份有限公司 Bundle deployment methodnd device and security framework
CN105511902A (en) * 2015-11-09 2016-04-20 Tcl集团股份有限公司 Android platform module dynamic loading method and system

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103034789A (en) * 2012-12-10 2013-04-10 山东中创软件商用中间件股份有限公司 Bundle deployment methodnd device and security framework
CN105511902A (en) * 2015-11-09 2016-04-20 Tcl集团股份有限公司 Android platform module dynamic loading method and system

Also Published As

Publication number Publication date
CN109032684A (en) 2018-12-18

Similar Documents

Publication Publication Date Title
CN105657191B (en) Application increment upgrading method and system based on Android system
EP2717542B1 (en) Application management method and application platform
CN104252342B (en) Embedded application implementation method and device capable of configuring parameters
CN107992308B (en) Plug-in management method for android terminal application program
CN106569880B (en) Method and system for dynamically sharing resources between Android applications
WO2018129509A1 (en) Managing, using, and updating application resources
CN111427596B (en) Software upgrading method and device and terminal equipment
WO2006110976A1 (en) Implementing customizable container services as component wireless applications
US10404568B2 (en) Agent manager for distributed transaction monitoring system
CN106502717B (en) Application program running method and device
CN114064024A (en) Method, apparatus, device, storage medium, and program product for developing micro-application
CN110968331A (en) Method and device for running application program
CN109240733A (en) A kind of method and terminal updating advertisement SDK based on Android system
CN110597564A (en) Installation package construction and service component loading method, device and terminal equipment
CN107977274B (en) SDK calling control method and device
CN114968406B (en) Plug-in management method and device, electronic equipment and storage medium
CN107402792B (en) Integration method, device, equipment and storage medium of application software installation package
CN109213533B (en) Advertisement SDK dynamic loading method, device and terminal
CN109343970B (en) Application program-based operation method and device, electronic equipment and computer medium
CN105404522A (en) Method for building intelligent terminal application program, device for building intelligent terminal application program and intelligent terminal
CN106778270B (en) Malicious application detection method and system
WO2021097683A1 (en) Android system starting method and apparatus, device, and storage medium
CN109032684B (en) Android system based broadcast plug-in implementation method and terminal
US20220326939A1 (en) Mobile service upgrade method and apparatus, and terminal
CN107092601B (en) Resource file construction method, resource file application method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
CB02 Change of applicant information
CB02 Change of applicant information

Address after: 516006 TCL technology building, No.17, Huifeng Third Road, Zhongkai high tech Zone, Huizhou City, Guangdong Province

Applicant after: TCL Technology Group Co.,Ltd.

Address before: 516006 Guangdong province Huizhou Zhongkai hi tech Development Zone No. nineteen District

Applicant before: TCL RESEARCH AMERICA Inc.

GR01 Patent grant
GR01 Patent grant