CN113448651B - Method and device for realizing application singleton function - Google Patents

Method and device for realizing application singleton function Download PDF

Info

Publication number
CN113448651B
CN113448651B CN202111008251.0A CN202111008251A CN113448651B CN 113448651 B CN113448651 B CN 113448651B CN 202111008251 A CN202111008251 A CN 202111008251A CN 113448651 B CN113448651 B CN 113448651B
Authority
CN
China
Prior art keywords
window
application
level
identifier
layer
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
CN202111008251.0A
Other languages
Chinese (zh)
Other versions
CN113448651A (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.)
Beijing ByteDance Network Technology Co Ltd
Original Assignee
Beijing Jingling Information System Technology 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 Beijing Jingling Information System Technology Co Ltd filed Critical Beijing Jingling Information System Technology Co Ltd
Priority to CN202111008251.0A priority Critical patent/CN113448651B/en
Publication of CN113448651A publication Critical patent/CN113448651A/en
Application granted granted Critical
Publication of CN113448651B publication Critical patent/CN113448651B/en
Priority to PCT/CN2022/104470 priority patent/WO2023029747A1/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

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

Method and device for realizing application singleton function
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 (7)

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 instance, specifically:
judging whether the application has a corresponding top window identifier or not;
determining that the application with the corresponding top-level window identifier is a running instance;
under the condition that the application has a running instance, activating a top-level window of the application by a calling window manager, wherein the step of activating the top-level window of the application by the calling window manager is as follows:
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;
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 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.
3. The method for implementing application singleton function of claim 2, 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.
4. The method for implementing application singleton function of claim 2, 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.
5. An apparatus for implementing a singleton function, the apparatus comprising:
a determining module, configured to determine whether the application has an instance running under a condition that a start command of the application is received, and specifically configured to:
judging whether the application has a corresponding top window identifier or not;
determining that the application with the corresponding top-level window identifier is a running instance;
a calling module, configured to, when the application has an instance in which the application runs, call a window manager to activate a top-level window of the application, where activating the top-level window of the application by the call window manager is:
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;
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.
6. 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 the application singleton function as claimed in any one of claims 1 to 4 are implemented when the processor executes the program.
7. A non-transitory computer-readable storage medium, on which a computer program is stored, wherein the computer program, when being executed by a processor, implements the steps of the implementation method of the application singleton function according to any one of claims 1 to 4.
CN202111008251.0A 2021-08-31 2021-08-31 Method and device for realizing application singleton function Active CN113448651B (en)

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 CN113448651A (en) 2021-09-28
CN113448651B true 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)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113448651B (en) * 2021-08-31 2021-12-14 北京鲸鲮信息系统技术有限公司 Method and device for realizing application singleton function
CN115567733B (en) * 2022-11-15 2023-02-07 易方信息科技股份有限公司 SDK-based live broadcast room switching method, device, terminal and storage medium

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2019233241A1 (en) * 2018-06-06 2019-12-12 Oppo广东移动通信有限公司 Method and apparatus for starting application program, and storage medium and terminal

Family Cites Families (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8327286B2 (en) * 2008-03-13 2012-12-04 Microsoft Corporation Unifying application launchers and switchers
US9880861B2 (en) * 2013-06-05 2018-01-30 Tencent Technology (Shenzhen) Company Limited Method and apparatus for page view switching
CN104461242B (en) * 2014-12-08 2017-12-01 深圳市嘉乐派科技有限公司 A kind of multi-window interface implementation method based on Android operation system
CN105528257B (en) * 2016-01-08 2021-01-05 腾讯科技(深圳)有限公司 Single-process data processing method and device
CN106598572B (en) * 2016-11-17 2018-08-03 武汉斗鱼网络科技有限公司 Method and device is exited in a kind of application
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
CN109828804A (en) * 2018-12-11 2019-05-31 中新金桥数字科技(北京)有限公司 Preservation and restoration methods and its system based on multiwindow in Android Pad program
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

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2019233241A1 (en) * 2018-06-06 2019-12-12 Oppo广东移动通信有限公司 Method and apparatus for starting application program, and storage medium and terminal

Also Published As

Publication number Publication date
CN113448651A (en) 2021-09-28
WO2023029747A1 (en) 2023-03-09

Similar Documents

Publication Publication Date Title
CN113448651B (en) Method and device for realizing application singleton function
WO2021093619A1 (en) Method, device and medium relating to android system dual-screen display multi-input device
CN109308241B (en) Method and device for monitoring starting process of application program, terminal equipment and storage medium
CN110333918B (en) Method and equipment for managing boarder programs
CN108491124B (en) Interface processing method and equipment, storage medium and terminal thereof
CN106959879B (en) Control method and electronic equipment
US20230195298A1 (en) Permission setting method and apparatus and electronic device
CN112114761A (en) Wireless screen projection control method and device, terminal equipment and readable storage medium
CN107832105B (en) Application program starting method, starting device and computer 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
US20210271491A1 (en) Application processing method, device, electronic device and storage medium
CN113268212A (en) Screen projection method and device, storage medium and electronic equipment
WO2018112775A1 (en) Method for operating another operating system, apparatus and electronic device
CN107765972A (en) A kind of android terminal screenshotss method
CN114281555A (en) Application state synchronization method and device, electronic equipment and storage medium
CN108255547B (en) Application program control method and device
CN113268286A (en) Application starting method and device, projection equipment and storage medium
US8225328B2 (en) Access to a target object with desired functionality
US11425203B2 (en) Commissioning a virtualized network function
CN114281491A (en) Application stack management method and device, electronic equipment and storage medium
CN111880702A (en) Interface switching method and device and electronic equipment
CN112328197A (en) Multi-screen display method and device and storage medium
US20140282128A1 (en) System and Method for a User Interface Controller for Mandatory and Shared User Interface Functions
CN117707388A (en) Method, equipment and storage medium for managing application icon desktop

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