CN113448651A - Method and device for realizing application singleton function - Google Patents
Method and device for realizing application singleton function Download PDFInfo
- Publication number
- CN113448651A CN113448651A CN202111008251.0A CN202111008251A CN113448651A CN 113448651 A CN113448651 A CN 113448651A CN 202111008251 A CN202111008251 A CN 202111008251A CN 113448651 A CN113448651 A CN 113448651A
- Authority
- CN
- China
- Prior art keywords
- window
- application
- level
- layer
- identifier
- 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.)
- Granted
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/44—Arrangements for executing specific programs
- G06F9/445—Program loading or initiating
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Stored Programmes (AREA)
Abstract
The invention provides a method and a device for realizing a single-instance function, wherein the method comprises the following steps: under the condition of receiving a starting command of an application, judging whether the application has an operating example; in the case that the application has a running instance, invoking a window manager to activate a top-level window of the application; and in the case of the instance in which the application is not running, calling the window manager to newly build and activate the top-level window of the application. The invention realizes that the running application can be quickly activated by using the starter under the condition of not depending on the task navigation bar.
Description
Technical Field
The invention relates to the technical field of application development, in particular to a method and a device for realizing application singleton function.
Background
Compared with the traditional devices such as a PC and a notebook, the operating systems such as iOS and Android running on the mobile device are generally single-case applications due to the limitations of a screen, a processor, a memory and the like and the significant difference between the mode of operating the device by a user and the computer.
Disclosure of Invention
The embodiment of the invention provides a method and a device for realizing a single-case function of an application, which can realize that the application can be quickly activated by a starter before being started without depending on a task navigation bar.
In a first aspect, an embodiment of the present invention provides a method for implementing a single-instance function, where the method includes:
under the condition of receiving a starting command of an application, judging whether the application has an operating example;
in the case that the application has a running instance, invoking a window manager to activate a top-level window of the application;
and in the case of the instance in which the application is not running, calling the window manager to newly build and activate the top-level window of the application.
According to the method for implementing the application singleton function provided by the invention, the judging whether the application has an operating instance comprises the following steps:
judging whether the application has a corresponding top window identifier or not;
an application having a corresponding top-level window identification is determined to have a running instance.
According to the method for implementing the application singleton function provided by the invention, the method for activating the top-level window of the application by the call window manager comprises the following steps:
calling the window manager to activate a top-level window stored in a window stack based on the top-level window identifier of the application; wherein the top-level window corresponds to the top-level window identifier.
According to the method for implementing the application singleton function provided by the invention, the step of calling the window manager to newly build and activate the top-layer window of the application comprises the following steps:
and calling the window manager to newly build a top-layer window of the application and a top-layer window identifier corresponding to the top-layer window, activating the top-layer window, and storing the newly built top-layer window of the application in the window stack.
According to the method for implementing the application singleton function provided by the present invention, after the step of calling the window manager to newly build and activate the top-level window of the application, the method further comprises the following steps:
and sending the top layer window identifier corresponding to the newly-built top layer window of the application to the starter.
According to the implementation method of the application singleton function provided by the invention, after the top-level window of the application is activated, the method further comprises the following steps:
under the condition that a new top-layer window instruction is received, the window manager is continuously called to newly create a top-layer window of the application and a top-layer window identifier corresponding to the top-layer window identifier through the starter, and the newly created top-layer window is activated, wherein the newly created top-layer window of the application is stored in the window stack;
under the condition that a top-layer window updating instruction is received, the window manager is called through the starter to update the top-layer window of the application and the corresponding top-layer window identifier of the top-layer window, the updated top-layer window is activated, and the updated top-layer window identifier is sent to the starter, wherein the updated top-layer window of the application is the top-layer window in the window stack;
under the condition that a top window closing instruction is received, searching the window stack of the application, judging whether a window exists in the window stack of the application, if so, sending a stack top window identifier in the window stack of the application to the starter, and if not, clearing the top window identifier of the application in the starter.
In a second aspect, an embodiment of the present invention provides an apparatus for implementing a singleton function, where the apparatus includes: the device comprises a judging module, a calling module and an activating module. The device comprises a judging module, a judging module and a judging module, wherein the judging module is used for judging whether the application has an operating example or not under the condition of receiving a starting command of the application; the calling module is used for calling a window manager to activate a top-level window of the application under the condition that the application has an operating instance; and the activation module is used for calling the window manager to newly build and activate the top-layer window of the application under the condition that the application does not have the running instance.
According to the apparatus for implementing a single-instance function of an application provided by the embodiment of the present invention, the determining module determines whether the application has an instance of running, including:
judging whether the application has a corresponding top window identifier or not through the starter;
an application having a corresponding top-level window identification is determined to have a running instance.
In a third aspect, an embodiment of the present invention provides an electronic device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, where the processor executes the program to implement the steps of the method for implementing the application singleton function according to any one of the above items.
In a fourth aspect, an embodiment of the present invention provides a non-transitory computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the steps of the implementation method of the application singleton function described in any one of the above.
According to the method and the device for realizing the single-instance function of the application, provided by the embodiment of the invention, under the condition that a starting command of the application is received, whether the application has an instance running or not is judged through a starter; under the condition that the application has an operating instance, a top-level window of the application is activated by calling a window manager through a starter, so that the application corresponding to the top-level window is set as the current active application of the system, and the function of activating the application started before is realized; and in the case of the instance in which the application is not running, calling a window manager through a launcher to newly build and activate a top-level window of the application.
Drawings
In order to more clearly illustrate the technical solutions of the present disclosure or the prior art, the drawings needed for the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present disclosure, and other drawings can be obtained by those skilled in the art without creative efforts.
Fig. 1 is a schematic flowchart of a method for implementing a single-instance function according to an embodiment of the present invention;
FIG. 2 is a diagram of three scenarios provided by an embodiment of the invention after activating a top-level window of an application;
FIG. 3 is a program flow diagram of a method for implementing a single instance function of a multi-agent interactive application provided by an embodiment of the present invention;
FIG. 4 is a schematic diagram of three scenarios of multi-subject interaction provided by embodiments of the present invention;
fig. 5 is a schematic diagram of an apparatus for implementing a single-instance function according to an embodiment of the present invention;
fig. 6 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present disclosure more clear, the technical solutions of the embodiments of the present disclosure will be described clearly and completely with reference to the drawings in the embodiments of the present disclosure, and it is obvious that the described embodiments are some, but not all, of the embodiments of the present disclosure. All other embodiments, which can be obtained by a person skilled in the art without making creative efforts based on the embodiments of the present disclosure, belong to the protection scope of the embodiments of the present disclosure.
The application singleton function means that after a certain component is created, when other people call the component, the creation is not repeated, but the instance of the created component is returned to a caller, which means that a plurality of callers share the same component, thereby saving the time and memory of repeated creation.
The application singleton is a system implementation mode. Only one particular singleton to be run is included in its core structure. By applying singletons, it can be ensured that only one instance is running at the same time for one application in the system. In the mobile device, the whole system only needs one executable instance, which is beneficial to coordinating the overall behavior of the system.
In the art known to the inventors, there are several ways in which a single instance of an application may be implemented. One way is to implement application singles, such as iOS, Android, etc., at the system level through a defined Software Development Kit (SDK) and development framework. For example, Android applications are started by an Activity Management Service (AMS). The other mode is realized on an application level, and a developer of the application controls the application to be an application singleton mode in code logic when developing the App.
Conventional desktop systems, such as Windows and Linux, do not have a function of implementing an application singleton, and it is difficult for such systems to implement a function of quickly activating a started application provided by an application singleton of a mobile-end system after hiding a task navigation bar when the system runs on a mobile-end-like device.
In the embodiment of the invention, the disclosed implementation method can be applied to various mobile devices, terminal devices and the like. The mobile device and the terminal device may be tablet Pad, smart phone, smart PDA, electronic book, etc., as generally understood by those skilled in the art.
Although not explicitly described, the method of the embodiment of the present invention may be applied to various desktop systems without application singleton function, such as Linux, Windows, Mac OS, etc., and may be particularly applicable to Linux.
In the embodiment of the present invention, the Linux includes various releases implemented on the basis of Linux kernel, such as Ubuntu, Debian, etc.
Referring to fig. 1, a schematic flow chart of a method for implementing a single-instance function according to an embodiment of the present invention is shown, where the method includes:
and 110, judging whether the application has a running instance or not when receiving a starting command of the application.
In this step, the application refers to software installed in a mobile device, a similar mobile device, or a terminal device scene to implement a specific function, and may be used by a single user or multiple users. When the operating system is used, different applications can be added or deleted according to the requirements of users.
A running instance refers to a series of processes in an operating system and the memory blocks allocated for those processes, with a process being defined as a running program.
The start command may be a single/double click mouse operation on the application by the user, a shortcut key operation, or a command line operation, etc. The launching type may include a visualization interface (Activity) launching manner, a system Service (Service) launching manner, a broadcast launching manner, a data Provider (Content Provider) launching manner, and the like. A start command received for an application may also be understood as whether the application process has the right to start by some type of start.
In the case of an application having a running instance, the invoking window manager activates the top-level window of the application 120.
In this step, the window manager is the main graphic management module of the user in the system. A window manager is a program that controls the appearance, location, window hierarchy of windows and provides a way for users to manipulate these window programs. When the window manager starts to operate, the interaction between the server and the client is redirected to the window manager. Whenever a new window is to be displayed, the request is redirected to the window manager, which determines the initial position of the window and its window level. The window manager is also responsible for processing the graphic representation, and when the user graphically displays the window, the window manager cancels the mapping of the window, completes the appropriate action and displays the window as the graphic representation. Some window managers do not support the illustrated functionality. The main goal of the window manager is to manage the windows. Many window managers provide additional functionality such as handling mouse clicks on the root window, presenting panes and other visualization elements, handling buttons, determining which application to execute at startup, etc. Common Window manager implementations, such as DWM Window manager in Windows, X Window in Linux, Wayland, etc.
A window refers to a basic unit set in a graphical user interface by an application program for using data. The application and data are integrated within the window. In the window, the user can operate the application program in the window to manage, generate and edit the data. Usually, a menu and an icon are arranged around the window, and data is placed in the center. The window interface is used for displaying the computer operation user interface in a window form.
Each time a user begins to run an application, the application creates and displays a window; when the user manipulates an object in the window, the program reacts accordingly. The user terminates the running of a program by closing a window; the corresponding application is selected by selecting the corresponding application window.
Correspondingly, the top window refers to the window (window) which is the outermost window opened by the browser, displayed on top, covering the other windows, and having no other windows blocking it.
Activation refers to bringing the top-level window to the foreground, i.e., set to the top of the application level.
Specifically, in the embodiment of the present invention, the user has performed a single/double-click operation, a shortcut operation, or a command line operation on an icon of the application, that is, the application has a running instance, and the top-level window of the application is displayed at the top of the application hierarchy by invoking the window manager through the launcher.
In the case of an instance of the application not running, the windows manager is invoked to create and activate the top level window of the application 130.
In this step, the new top-level window may be understood as that, when the user does not perform a single/double-click operation, a shortcut operation, or a command line operation on an icon of the application, that is, when the application does not have a running instance, the application does not have the top-level window, and the top-level window is established for such application.
Activating the top-level window of the application may be understood as bringing the newly created top-level window to the foreground, set as the top of the application hierarchy.
The method for implementing the application single-case function provided by the embodiment of the invention judges whether the application has an operating case or not through the starter under the condition of receiving the starting command of the application; under the condition that the application has an operating instance, a top-level window of the application is activated by calling a window manager through a starter, so that the application corresponding to the top-level window is set as the current active application of the system, and the function of activating the application started before is realized; and in the case of the instance in which the application is not running, calling a window manager through a launcher to newly build and activate a top-level window of the application.
Based on any of the above embodiments, an embodiment of the present invention provides a flowchart for determining whether an application has an instance running, which specifically includes:
and judging whether the application has a corresponding top-level window identifier or not, and determining that the application with the corresponding top-level window identifier has a running instance.
Specifically, the top-level window identification refers to a notation used to identify the top-level window, such as may be implemented by a process id. The top-level window identification of each application is unique, represents the identity or name of any top-level window in any application and is different from other top-level windows. The top-level window identification can be used to identify which application the window belongs to.
Correspondingly, judging whether the application of the user has a corresponding top-level window identifier by using the starter, wherein the application is started before, namely the application has an operating instance, under the condition that the application has the corresponding top-level window identifier; in the case where an application does not have a corresponding top-level window identification, this indicates that the application has not previously started, i.e., that the application is not running.
Because the top-level window identifier of the application has the function of uniquely identifying which application the window is, whether the application of the user is opened or not can be accurately judged by using the top-level window identifier.
Based on any embodiment, the invoking window manager activates the top-level window of the application, including:
based on the top window identification of the application, calling a window manager to activate the top window stored in the window stack; wherein the top-level window corresponds to the top-level window identifier.
In this step, the window stack refers to a container storing different types of windows, such as an application window, a document type window, and the like.
Specifically, the top-level window is located at the uppermost layer of the window stack, and the user has performed a single/double-click operation, a shortcut operation, or a command line operation on a tile or an icon of the application, that is, in a case that the application has a running instance, the top-level window stored in the window stack is activated based on the top-level window identifier corresponding to the top-level window, and the top-level window is displayed at the uppermost of the application hierarchy, that is, the user can open the application that has been started before at this time.
The top-level window stored in the window stack is activated by calling the window manager, so that the started application can be positioned, and the function of quickly activating the started application is achieved.
Based on any of the above embodiments, the invoking window manager creates and activates the top-level window of the application, including:
and calling a window manager to newly build a top-layer window of the application and a top-layer window identifier corresponding to the top-layer window, activating the top-layer window, and storing the newly built top-layer window of the application in a window stack.
Specifically, the newly-built top-level window is located on the uppermost layer in the application window stack, when a user does not perform single/double-click operation, shortcut key operation or command line operation on an application image block or icon, that is, the application does not have an instance of operation, a top-level window identifier is correspondingly generated for the newly-built top-level window for the application, the newly-built top-level window is stored in the window stack, the top-level window is activated based on the newly-built top-level window identifier, that is, the top-level window is adjusted to the foreground and is set as the uppermost of the application hierarchy, and the user can also judge which application is opened through the top-level window identifier.
Under the condition that a user does not open an application, namely the application does not have a top-layer window, a top-layer window is newly built for the application at the moment, a top-layer window identifier is correspondingly generated, the newly built top-layer window is activated by utilizing a window manager, the application can also be positioned, and the function of quickly activating the started application is achieved.
Based on the above embodiment, the method further includes: after the top-level window of the application is newly created and activated by calling the window manager, the method further comprises the following steps:
and sending the top window identifier corresponding to the top window of the newly-built application to the starter.
Where the launcher includes a representation (e.g., an icon or command line, etc.) of the application or content that is selectable to launch execution and access to the represented application or content. Common initiator implementations, such as Launchpad in Mac OS, Start in Windows, Unity in Linux, etc.
Specifically, when a user does not perform a single/double-click operation, a shortcut operation, or a command line operation on an icon of an application, that is, when the application does not have a running instance, a top-level window and a top-level window identifier need to be newly created for the application, and the top-level window identifier is sent to a starter to be saved.
Based on any of the above embodiments, referring to fig. 2, schematic diagrams of three cases after activating a top-level window of an application are provided for the embodiment of the present invention, including:
210, under the condition that a new top-level window instruction is received, continuing to call the top-level window of the new application of the window manager and the corresponding top-level window identifier through the starter, and activating the newly-built top-level window, wherein the top-level window of the new application is stored in the window stack.
In the step, an instruction of newly building a top window is executed, a top window identifier is correspondingly generated, the top window of the newly built application is stored in a window stack, the top window is activated based on the newly built top window identifier, namely, the top window is adjusted to a foreground and is set as the top of an application level, and a user can also judge which application is activated through the top window identifier.
220, under the condition that a command for updating the top-level window is received, calling a window manager through the starter to update the top-level window of the application and the corresponding top-level window identifier thereof, activating the updated top-level window, and sending the updated top-level window identifier to the starter, wherein the top-level window of the updated application is the top-level window in the updated window stack.
In this step, updating refers to switching a top-level window of an application by clicking or touching, for example, switching different interfaces in an application after the application is opened.
Specifically, in the process of switching the interface in the application, a window manager is called to update the top-level window of the application and the corresponding top-level window identifier thereof, activate the updated top-level window, and send the updated top-level window identifier to the initiator for storage.
And 230, under the condition that a top window closing instruction is received, searching the window stack of the application, judging whether a window exists in the window stack of the application, if so, sending the stack top window identifier in the window stack of the application to the starter, and if not, clearing the top window identifier applied in the starter.
In the step, whether other windows exist in the window stack corresponding to the application is searched, if other windows exist in the window stack, the uppermost window except the closed window in the window stack is used as a top window, and a top window identifier corresponding to a new top window is stored in a starter; if the application has no window, the signal 0 is transmitted to the starter to inform the starter that the application has no window, and a new process is directly started when the application is triggered to be started next time.
Further, the implementation of the present disclosure is further explained in an additional way: referring to fig. 3 in particular, fig. 3 is a program flow diagram of a method for implementing a single-instance function of an application of multi-agent interaction, and a process for implementing the single-instance function of the application is described from a user side, a launcher side, an application side, and a window manager side.
And the implementation of the application singleton function comprises the following steps:
in step S1, the user clicks the application icon to start the application, or executes an application start command.
Step S2, searching whether the application has a corresponding top-level window through the starter, and if the application does not have the top-level window, executing step S3; if the application has a top-level window, step S7 is performed.
Step S3, a new process is started for the application by the launcher.
And step S4, after the process of the application is started, calling a window manager through a starter to newly build a top-level window.
And step S5, adding the new top-level window into the window stack through the window manager, and activating the top-level window.
And step S6, storing the top-level window mark generated corresponding to the top-level window into the starter.
Step S7, using the top window identifier of the application through the launcher, calls the window manager to activate the top window (the top window is brought to the foreground, i.e. set as the top of the application hierarchy).
Wherein, there are three cases of application window changes after activating the top-level window of the application, which are: newly creating a top-level window, updating the top-level window and closing the top-level window, and referring to fig. 4, schematic diagrams showing three situations of multi-subject interaction are shown.
1. And under the condition that the application receives a user instruction for building a top window, the newly built top window correspondingly generates a top window identifier, a window manager is called to activate the newly built top window, and the top window identifier is stored in the starter.
2. The user operates the application by clicking or touching and the like to generate an instruction for updating the top window, the application executes the instruction to switch the interface, the window manager activates the switched top window, and the switched top window identifier corresponding to the switched top window is stored in the starter.
3. Under the condition that a top window closing instruction is received, whether other windows exist in a window stack corresponding to the application or not is searched, if other windows exist in the window stack, stack top windows in the other windows are used as top windows, and a top window identifier corresponding to a new top window is stored in a starter; if the application has no window, the signal 0 is transmitted to the starter to tell the starter that the application has no window, and a new process is directly started when the application is triggered to start next time.
Based on any of the above embodiments, referring to fig. 5, an apparatus for implementing a single-instance function according to an embodiment of the present invention includes: a decision module 510, a call module 520, and an activation module 530. The determining module 510 is configured to determine, by a starter, whether an application has an instance of running, when a start command of the application is received; a calling module 520, configured to call, via a launcher, a window manager to activate a top-level window of an application if the application has an instance of running; and an activation module 530, configured to invoke, by the initiator, the window manager to create and activate a top-level window of the application if the application does not have an instance in which to run.
According to the device for realizing the single-instance function of the application, provided by the embodiment of the invention, under the condition that a starting command of the application is received, whether the application has an operating instance or not is judged through the starter; if the application has an operating example, calling a window manager to activate a top-level window of the application through a starter, and further setting the application corresponding to the top-level window as the current active application of the system to activate the function of the application started before; and if the application does not have the running example, calling a window manager through the starter to newly build and activate a top-layer window of the application.
Based on any of the above embodiments, the determining module 510 is specifically configured to:
judging whether the application has a corresponding top window identifier or not through the starter;
if the application has the corresponding top-level window identifier, the application has an operating instance;
if the application does not have a corresponding top-level window identifier, the application does not have a running instance.
Based on any of the above embodiments, the invoking module 520 is specifically configured to:
calling the window manager to activate the top window stored in the window stack based on the top window identifier of the application through the starter; wherein the top-level window corresponds to the top-level window identifier.
Based on any of the above embodiments, the activation module 530 is specifically configured to:
and calling the window manager to newly build a top-layer window of the application and a top-layer window identifier corresponding to the top-layer window through the starter, activating the top-layer window, and storing the newly built top-layer window of the application in the window stack.
Based on any embodiment above, the apparatus further comprises:
and the sending module is used for sending the top layer window identifier corresponding to the newly-built top layer window of the application to the starter.
According to any of the above embodiments, after activating the top-level window of the application, the apparatus further includes:
the new building module is used for calling the window manager to build a top layer window of the application and a top layer window identifier corresponding to the top layer window in a new building mode under the condition that a new top layer window instruction is received, and activating the top layer window after the new building is started, wherein the top layer window of the application is stored in the window stack;
the updating module is used for calling the window manager to update the top window of the application and the corresponding top window identifier thereof under the condition of receiving a top window updating instruction, activating the updated top window, and sending the updated top window identifier to the starter, wherein the top window of the application is updated to the top window in the window stack;
the closing module is used for searching the window stack of the application under the condition of receiving a top window closing instruction, judging whether a window exists in the window stack of the application, sending a stack top window identifier in the window stack of the application to the starter if the window exists in the window stack of the application, and clearing the top window identifier of the application in the starter if the window does not exist in the window stack of the application.
Fig. 6 is a schematic structural diagram of an electronic device according to an embodiment of the present invention, and as shown in fig. 6, the electronic device may include: a processor (processor) 610, a communication Interface (Communications Interface) 620, a memory (memory) 630 and a communication bus 640, wherein the processor 610, the communication Interface 620 and the memory 630 communicate with each other via the communication bus 640. The processor 610 may call logical commands in the memory 630 to perform the following method: under the condition of receiving a starting command of an application, judging whether the application has an operating example or not through a starter; if the application has an operating example, a window manager is called through the starter to activate a top-level window of the application; and if the application does not have the running example, calling the window manager through the starter to newly build and activate the top-layer window of the application.
In addition, the logic commands in the memory 630 may be implemented in the form of software functional units and stored in a computer readable storage medium when the logic commands are sold or used as independent products. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes a plurality of commands for enabling 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.
Embodiments of the present invention further provide a non-transitory computer-readable storage medium, on which a computer program is stored, where the computer program is implemented to perform the method provided in the foregoing embodiments when executed by a processor, and the method includes: under the condition of receiving a starting command of an application, judging whether the application has an operating example or not through a starter; if the application has an operating example, a window manager is called through the starter to activate a top-level window of the application; and if the application does not have the running example, calling the window manager through the starter to newly build and activate the top-layer window of the application.
The above-described embodiments of the apparatus are merely illustrative, and 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 modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
Through the above description of the embodiments, those skilled in the art will clearly understand that each embodiment can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware. With this understanding in mind, the above technical solutions may be embodied in the form of a software product, which can be stored in a computer-readable storage medium, such as ROM/RAM, magnetic disk, optical disk, etc., and includes commands for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the method according to the embodiments or some parts of the embodiments.
Finally, it should be noted that: the above examples are only intended to illustrate the technical solution of the present invention, but not to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.
Claims (10)
1. A method for realizing application singleton function is applied to a starter, and is characterized by comprising the following steps:
under the condition of receiving a starting command of an application, judging whether the application has an operating example;
in the case that the application has a running instance, invoking a window manager to activate a top-level window of the application;
and in the case of the instance in which the application is not running, calling the window manager to newly build and activate the top-level window of the application.
2. The method for implementing the application singleton function according to claim 1, wherein the determining whether the application has a running instance comprises:
judging whether the application has a corresponding top window identifier or not;
an application having a corresponding top-level window identification is determined to have a running instance.
3. The method for implementing application singleton function of claim 1, wherein the invoking window manager activates a top-level window of the application, comprising:
calling the window manager to activate a top-level window stored in a window stack based on the top-level window identifier of the application; wherein the top-level window corresponds to the top-level window identifier.
4. The method for implementing the application singleton function of claim 1, wherein the invoking the window manager to create and activate a top-level window of the application comprises:
and calling the window manager to newly build a top-layer window of the application and a top-layer window identifier corresponding to the top-layer window, activating the top-layer window, and storing the newly built top-layer window of the application in the window stack.
5. The method for implementing application singleton function of claim 4, wherein after the invoking of the window manager to create and activate the top-level window of the application, the method further comprises:
and sending the top layer window identifier corresponding to the newly-built top layer window of the application to the starter.
6. The method for implementing application singleton function of claim 4, wherein after activating a top-level window of the application, the method further comprises:
under the condition that a new top window establishing instruction is received, calling the window manager to establish a top window of the application and a corresponding top window identifier thereof, and activating the newly established top window, wherein the newly established top window of the application is stored in the window stack;
under the condition that a top-layer window updating instruction is received, calling the window manager to update the top-layer window of the application and the corresponding top-layer window identifier of the top-layer window, activating the updated top-layer window, and sending the updated top-layer window identifier to the starter, wherein the updated top-layer window of the application is the top-layer window in the window stack;
under the condition that a top window closing instruction is received, searching the window stack of the application, judging whether a window exists in the window stack of the application, if so, sending a stack top window identifier in the window stack of the application to the starter, and if not, clearing the top window identifier of the application in the starter.
7. An apparatus for implementing a singleton function, the apparatus comprising:
the judging module is used for judging whether the application has an operating example or not under the condition of receiving a starting command of the application;
the calling module is used for calling a window manager to activate a top-level window of the application under the condition that the application has an operating instance;
and the activation module is used for calling the window manager to newly build and activate the top-layer window of the application under the condition that the application does not have the running instance.
8. The apparatus for implementing a singleton function of claim 7, wherein the determining module is specifically configured to:
judging whether the application has a corresponding top window identifier or not;
an application having a corresponding top-level window identification is determined to have a running instance.
9. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the steps of the method for implementing application singleton functionality according to any one of claims 1 to 6 are implemented when the processor executes the program.
10. A non-transitory computer-readable storage medium, on which a computer program is stored, the computer program, when being executed by a processor, implementing the steps of the implementation method of the application singleton function as claimed in any one of claims 1 to 6.
Priority Applications (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111008251.0A CN113448651B (en) | 2021-08-31 | 2021-08-31 | Method and device for realizing application singleton function |
PCT/CN2022/104470 WO2023029747A1 (en) | 2021-08-31 | 2022-07-07 | Method for implementing single instance function of application, and apparatus |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111008251.0A CN113448651B (en) | 2021-08-31 | 2021-08-31 | Method and device for realizing application singleton function |
Publications (2)
Publication Number | Publication Date |
---|---|
CN113448651A true CN113448651A (en) | 2021-09-28 |
CN113448651B CN113448651B (en) | 2021-12-14 |
Family
ID=77819103
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202111008251.0A Active CN113448651B (en) | 2021-08-31 | 2021-08-31 | Method and device for realizing application singleton function |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN113448651B (en) |
WO (1) | WO2023029747A1 (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115567733A (en) * | 2022-11-15 | 2023-01-03 | 易方信息科技股份有限公司 | SDK-based live broadcast room switching method, device, terminal and storage medium |
WO2023029747A1 (en) * | 2021-08-31 | 2023-03-09 | 北京字节跳动网络技术有限公司 | Method for implementing single instance function of application, and apparatus |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20090235200A1 (en) * | 2008-03-13 | 2009-09-17 | Microsoft Corporation | Unifying application launchers and switchers |
US20140365960A1 (en) * | 2013-06-05 | 2014-12-11 | Tencent Technology (Shenzhen) Company Limited | Method and apparatus for page view switching |
CN105528257A (en) * | 2016-01-08 | 2016-04-27 | 腾讯科技(深圳)有限公司 | Single process data processing method and device |
CN106598572A (en) * | 2016-11-17 | 2017-04-26 | 武汉斗鱼网络科技有限公司 | Application exiting method and apparatus |
CN109828804A (en) * | 2018-12-11 | 2019-05-31 | 中新金桥数字科技(北京)有限公司 | Preservation and restoration methods and its system based on multiwindow in Android Pad program |
WO2019233241A1 (en) * | 2018-06-06 | 2019-12-12 | Oppo广东移动通信有限公司 | Method and apparatus for starting application program, and storage medium and terminal |
Family Cites Families (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104461242B (en) * | 2014-12-08 | 2017-12-01 | 深圳市嘉乐派科技有限公司 | A kind of multi-window interface implementation method based on Android operation system |
CN108205417A (en) * | 2017-10-27 | 2018-06-26 | 珠海市魅族科技有限公司 | Switching method and device, the computer installation and readable storage medium storing program for executing of foreground application |
CN109725950B (en) * | 2018-12-29 | 2022-02-22 | 武汉斗鱼网络科技有限公司 | Method, device and storage medium for realizing single-instance operation of client |
CN113448651B (en) * | 2021-08-31 | 2021-12-14 | 北京鲸鲮信息系统技术有限公司 | Method and device for realizing application singleton function |
-
2021
- 2021-08-31 CN CN202111008251.0A patent/CN113448651B/en active Active
-
2022
- 2022-07-07 WO PCT/CN2022/104470 patent/WO2023029747A1/en unknown
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20090235200A1 (en) * | 2008-03-13 | 2009-09-17 | Microsoft Corporation | Unifying application launchers and switchers |
US20140365960A1 (en) * | 2013-06-05 | 2014-12-11 | Tencent Technology (Shenzhen) Company Limited | Method and apparatus for page view switching |
CN105528257A (en) * | 2016-01-08 | 2016-04-27 | 腾讯科技(深圳)有限公司 | Single process data processing method and device |
CN106598572A (en) * | 2016-11-17 | 2017-04-26 | 武汉斗鱼网络科技有限公司 | Application exiting method and apparatus |
WO2019233241A1 (en) * | 2018-06-06 | 2019-12-12 | Oppo广东移动通信有限公司 | Method and apparatus for starting application program, and storage medium and terminal |
CN109828804A (en) * | 2018-12-11 | 2019-05-31 | 中新金桥数字科技(北京)有限公司 | Preservation and restoration methods and its system based on multiwindow in Android Pad program |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2023029747A1 (en) * | 2021-08-31 | 2023-03-09 | 北京字节跳动网络技术有限公司 | Method for implementing single instance function of application, and apparatus |
CN115567733A (en) * | 2022-11-15 | 2023-01-03 | 易方信息科技股份有限公司 | SDK-based live broadcast room switching method, device, terminal and storage medium |
CN115567733B (en) * | 2022-11-15 | 2023-02-07 | 易方信息科技股份有限公司 | SDK-based live broadcast room switching method, device, terminal and storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN113448651B (en) | 2021-12-14 |
WO2023029747A1 (en) | 2023-03-09 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2021093619A1 (en) | Method, device and medium relating to android system dual-screen display multi-input device | |
US5274819A (en) | Management system for memory resident computer programs | |
US20230195298A1 (en) | Permission setting method and apparatus and electronic device | |
CN113448651B (en) | Method and device for realizing application singleton function | |
CN109308241B (en) | Method and device for monitoring starting process of application program, terminal equipment and storage medium | |
CN106371752B (en) | A kind of the virtual key implementation method and device of Android system intelligent terminal | |
CN108491124B (en) | Interface processing method and equipment, storage medium and terminal thereof | |
CN106959879B (en) | Control method and electronic equipment | |
CN112114761A (en) | Wireless screen projection control method and device, terminal equipment and readable storage medium | |
CN111767090A (en) | Method and device for starting small program, electronic equipment and storage medium | |
CN107832113A (en) | A kind of interface display method and device of android system application program | |
WO2018112775A1 (en) | Method for operating another operating system, apparatus and electronic device | |
CN107832105A (en) | A kind of application program launching method, starter and computer-readable recording medium | |
CN113268286B (en) | Application starting method and device, projection equipment and storage medium | |
CN110750284A (en) | Application quick starting method, terminal and computer readable storage medium | |
US20210271491A1 (en) | Application processing method, device, electronic device and storage medium | |
CN107765972A (en) | A kind of android terminal screenshotss method | |
US20240176678A1 (en) | Method, apparatus, electronic device and storage medium for application state synchronization | |
CN106484538A (en) | A kind of internal memory control method of terminal device, device and terminal device | |
US11425203B2 (en) | Commissioning a virtualized network function | |
US8225328B2 (en) | Access to a target object with desired functionality | |
CN105094896B (en) | Client terminal start-up method, apparatus and system on virtual platform | |
CN110879732A (en) | Method, device and storage medium for managing application icon desktop | |
CN114281491A (en) | Application stack management method and device, electronic equipment and storage medium | |
CN111880702A (en) | Interface switching method and device and electronic equipment |
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 | ||
GR01 | Patent grant | ||
GR01 | Patent grant | ||
TR01 | Transfer of patent right |
Effective date of registration: 20220331 Address after: 100041 B-0035, 2 floor, 3 building, 30 Shixing street, Shijingshan District, Beijing. Patentee after: BEIJING BYTEDANCE NETWORK TECHNOLOGY Co.,Ltd. Address before: 2005, floor 2, No. 39, West Street, Haidian District, Beijing 100082 Patentee before: Beijing jingling Information System Technology Co.,Ltd. |
|
TR01 | Transfer of patent right |