CN111382025A - Method and device for judging foreground and background states of application program and electronic equipment - Google Patents

Method and device for judging foreground and background states of application program and electronic equipment Download PDF

Info

Publication number
CN111382025A
CN111382025A CN201811626434.7A CN201811626434A CN111382025A CN 111382025 A CN111382025 A CN 111382025A CN 201811626434 A CN201811626434 A CN 201811626434A CN 111382025 A CN111382025 A CN 111382025A
Authority
CN
China
Prior art keywords
page
application program
state
preset variable
foreground
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.)
Pending
Application number
CN201811626434.7A
Other languages
Chinese (zh)
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 Microlive Vision Technology Co Ltd
Original Assignee
Beijing Microlive Vision 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 Microlive Vision Technology Co Ltd filed Critical Beijing Microlive Vision Technology Co Ltd
Priority to CN201811626434.7A priority Critical patent/CN111382025A/en
Publication of CN111382025A publication Critical patent/CN111382025A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3055Monitoring arrangements for monitoring the status of the computing system or of the computing system component, e.g. monitoring if the computing system is on, off, available, not available
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3003Monitoring arrangements specially adapted to the computing system or computing system component being monitored
    • G06F11/302Monitoring arrangements specially adapted to the computing system or computing system component being monitored where the computing system component is a software system
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2201/00Indexing scheme relating to error detection, to error correction, and to monitoring
    • G06F2201/865Monitoring of software

Abstract

The disclosure provides a method and a device for judging foreground and background states of an application program and electronic equipment. The method comprises the following steps: acquiring the value of a preset variable mark, wherein the preset variable mark is updated in real time based on the visible state and the invisible state of each page of the application program; according to the value of the preset variable mark, the foreground and background states of the application program can be quickly determined, so that different functions can be respectively realized aiming at the foreground state and the background state of the application program, and the performance of the application program is improved.

Description

Method and device for judging foreground and background states of application program and electronic equipment
Technical Field
The disclosure relates to the technical field of intelligent terminals, in particular to a method and a device for judging foreground and background states of an application program and electronic equipment.
Background
The intelligent terminal represented by a mobile phone, a tablet personal computer and the like has increasingly close relationship with daily work, study and life of people, and brings convenience and functional experience to users. At present, most intelligent terminals support a plurality of applications to be run simultaneously, wherein one of the applications runs in the foreground, the other applications run in the background, and the functions of the applications can be used simultaneously by switching the applications running in the foreground and the background.
The popularization of intelligent terminals also promotes the functions of application programs to be more and more diversified, so as to meet various user requirements. In actual applications, such functional scenarios occur, and it is necessary for an application program to execute different functions in a foreground state and a background state, respectively. However, in the prior art, there is no good way to quickly distinguish whether the application program is in a foreground state or a background state, which affects the implementation of some functions of the application program.
Disclosure of Invention
In order to overcome the above technical problems or at least partially solve the above technical problems, the following technical solutions are proposed:
in a first aspect, the present disclosure provides a method for determining a foreground and background status of an application, where the method includes:
acquiring the value of a preset variable mark, wherein the preset variable mark is updated in real time based on the visible state and the invisible state of each page of the application program;
and determining the foreground and background states of the application program according to the value of the preset variable mark.
In an optional implementation manner, the determining a foreground and background state of an application according to the value of the preset variable flag includes:
when the value of the preset variable mark is non-zero, determining that the application program is in a foreground state;
and when the value of the preset variable mark is zero, determining that the application program is in a background state.
In an alternative implementation, the method for updating the preset variable flag in real time based on the visible state and the invisible state of each page of the application program includes:
when a first page in the application program enters a visible state, executing addition processing on a preset variable mark;
and when a second page in the application program enters an invisible state, executing subtraction processing on the preset variable mark.
In an alternative implementation, the first page entering the visible state includes any one of:
opening the first page;
jumping from other pages to the first page;
returning to the first page from other pages opened on the first page.
In an alternative implementation, the second page entering the invisible state includes any one of:
closing the second page;
opening other pages in the second page;
and opening other application programs on the second page.
In an alternative implementation form of the present invention,
after the adding one process is executed to the preset variable mark, the method further comprises the following steps:
recording the state of the first page;
after the performing a subtraction process on the preset variable flag, the method further includes:
and recording the state of the second page.
In an optional implementation manner, before the application program is started, the value of the preset variable flag is zero.
In an optional implementation manner, after determining that the application is in the foreground state, the method further includes:
determining a page in a visible state in the application.
In a second aspect, the present disclosure provides an apparatus for determining a foreground/background status of an application, the apparatus comprising:
the acquisition module is used for acquiring the value of a preset variable mark, and the preset variable mark is updated in real time based on the visible state and the invisible state of each page of the application program;
and the judging module is used for determining the foreground and background states of the application program according to the value of the preset variable mark.
In an optional implementation manner, the determining module is specifically configured to determine that the application program is in a foreground state when the value of the preset variable flag is non-zero; and when the value of the preset variable mark is zero, determining that the application program is in a background state.
In an optional implementation, the apparatus further includes:
the updating module is used for performing addition processing on a preset variable mark when a first page in the application program enters a visible state; and when a second page in the application program enters an invisible state, executing subtraction processing on the preset variable mark.
In an alternative implementation, the first page entering the visible state includes any one of:
opening the first page;
jumping from other pages to the first page;
returning to the first page from other pages opened on the first page.
In an alternative implementation, the second page entering the invisible state includes any one of:
closing the second page;
opening other pages in the second page;
and opening other application programs on the second page.
In an optional implementation manner, the update module is further configured to record a state of the first page after performing an addition process on a preset variable flag; and recording the state of the second page after executing the subtraction processing on the preset variable mark.
In an optional implementation manner, before the application program is started, the value of the preset variable flag is zero.
In an optional implementation, the apparatus further includes:
and the determining module is used for determining the page in the visible state in the application program after determining that the application program is in the foreground state.
In a third aspect, the present disclosure provides an electronic device comprising:
a processor and a memory storing at least one instruction, at least one program, set of codes, or set of instructions, which is loaded and executed by the processor to implement the method as set forth in the first aspect of the present disclosure or any alternative implementation of the first aspect.
In a fourth aspect, the present disclosure provides a computer-readable storage medium for storing a computer instruction, program, code set or instruction set which, when run on a computer, causes the computer to perform a method as shown in the first aspect of the present disclosure or any of its optional implementations.
According to the method, the device and the electronic equipment for judging the foreground and background states of the application program, the value of the preset variable mark is obtained, and the preset variable mark is updated in real time based on the visible state and the invisible state of each page of the application program; according to the value of the preset variable mark, the foreground and background states of the application program can be quickly determined, so that different functions can be respectively realized aiming at the foreground state and the background state of the application program, and the performance of the application program is improved.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present disclosure, the drawings used in the description of the embodiments of the present disclosure will be briefly described below.
Fig. 1 is a schematic flowchart of a method for determining a foreground/background status of an application according to an embodiment of the present disclosure;
fig. 2 is a schematic structural diagram of a device for determining foreground and background states of an application according to an embodiment of the present disclosure;
fig. 3 is a schematic structural diagram of an electronic device according to an embodiment of the present disclosure.
Detailed Description
Reference will now be made in detail to the embodiments of the present disclosure, examples of which are illustrated in the accompanying drawings, wherein like or similar reference numerals refer to the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the drawings are exemplary only for the purpose of illustrating the present disclosure and should not be construed as limiting the same.
As used herein, the singular forms "a", "an", "the" and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will be further understood that the terms "comprises" and/or "comprising," when used in this specification, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof. It will be understood that when an element is referred to as being "connected" or "coupled" to another element, it can be directly connected or coupled to the other element or intervening elements may also be present. Further, "connected" or "coupled" as used herein may include wirelessly connected or wirelessly coupled. As used herein, the term "and/or" includes all or any element and all combinations of one or more of the associated listed items.
To make the objects, technical solutions and advantages of the present disclosure more apparent, embodiments of the present disclosure will be described in detail with reference to the accompanying drawings.
The embodiment of the present disclosure provides a method for determining a foreground and background state of an application, as shown in fig. 1, the method includes:
step S101: acquiring the value of a preset variable mark, wherein the preset variable mark is updated in real time based on the visible state and the invisible state of each page of the application program;
step S102: and determining the foreground and background states of the application program according to the value of the preset variable mark.
For the embodiment of the present disclosure, the execution subject of the method may be a terminal device, such as a mobile terminal, or may also be an application installed on the terminal device. In practical applications, the mobile terminal may include devices such as a mobile phone, a smart phone, a tablet computer, a notebook computer, a personal digital assistant, a portable multimedia player, a navigation device, and the like. It will be understood by those skilled in the art that the configuration according to the embodiments of the present disclosure can be applied to a fixed type terminal such as a digital television, a desktop computer, etc., in addition to elements particularly used for mobile purposes.
Specifically, in a feasible implementation manner, a manner of updating the preset variable flag in real time based on the visible state and the invisible state of each page of the application program includes:
when a first page in the application program enters a visible state, executing addition processing on a preset variable mark;
and when the second page in the application program enters an invisible state, executing subtraction processing on the preset variable mark.
Typically, the interface that a user sees in an application can be viewed as a specific page. For example, the interface currently seen by the user is the a page, a new interface can be entered by clicking a certain button or link of the a page, which is displayed as the B page, and the a page is equivalent to being covered. If the return button of the B page is clicked, the A page can be returned again, and the B page is closed. If the user clicks a certain button or link of the page B, a new interface can be entered, namely the displayed page C, and the page B is equivalent to being covered, and so on.
In the embodiment of the present disclosure, when the first page in the application program enters the visible state, an addition process is performed on the preset variable flag, that is, 1 is added to the value of the current preset variable flag. Wherein the first page entering the visible state includes any one of:
(1) opening the first page
Specifically, the first page is opened and the first page is in a visible state. In the embodiment of the present disclosure, every time a page is opened, an addition process is performed on the preset variable flag.
In practical application, pages can be opened under the conditions of opening an application program, opening a screen locking interface and the like.
(2) Jumping from other pages to the first page
Specifically, when jumping to the first page from another page, which is equivalent to opening the first page, the first page enters a visible state.
In practical applications, the page before the jump is equivalent to be covered, and may be in a pause state, that is, an invisible state, and it is necessary to perform a subtraction process on the preset variable flag with respect to the page before the jump.
(3) Returning to the first page from other pages opened in the first page
Specifically, returning to the first page from other pages is equivalent to re-opening the first page, and the first page enters a visible state.
In practical application, after returning to the original page, the other page is equivalently closed and will be in a closed state, that is, an invisible state, and it is necessary to perform a subtraction process on the preset variable flag for the other page.
In the embodiment of the present disclosure, when the second page in the application program enters the invisible state, a subtraction process is performed on the preset variable flag, that is, 1 is subtracted from the current value of the preset variable flag. Wherein the second page entering the invisible state includes any one of the following:
(1) close the second page
Specifically, the second page is closed, and the second page is in the invisible state. In the embodiment of the present disclosure, every time a page is closed, a decrement process is performed on the preset variable flag.
In actual application, the page may be closed when the application program is closed, the home key (start key) is clicked and returned to the desktop of the terminal device, and the screen is locked.
(2) Opening other pages in the second page
Specifically, if another page is opened in the second page, and the second page is equivalent to being covered, the second page enters an invisible state.
In practical application, a new page opened in an original page is in a visible state, and an addition process needs to be performed on a preset variable flag for the new page.
(3) Opening other applications on the second page
Specifically, opening other applications on the second page may cause the second page to enter a suspended state, that is, the second page enters an invisible state.
In the embodiment of the present disclosure, the first page and the second page may be any page in an application program, where "first" and "second" merely distinguish names of the pages and cannot be understood as limitations on page order or content, and in practical applications, the first page and the second page may be the same page, for example, when one page is opened, an addition process is performed on a preset variable flag, the page is closed, and then a subtraction process is performed on the preset variable flag. Alternatively, the first page and the second page may be different pages, for example, when the second page is opened from the first page, the first page enters the invisible state and needs to perform a subtraction process on the preset variable flag, and when the second page enters the visible state and needs to perform an addition process on the preset variable flag. Subsequently, if the first page is returned from the second page, the second page enters the invisible state at this time, and the preset variable flag needs to be subjected to subtraction processing, and the first page enters the visible state, and the preset variable flag needs to be subjected to addition processing. It can be understood that each page in the application program can be processed by referring to the corresponding methods of the first page and the second page, and details are not described herein.
In the disclosed example, the value of the preset variable flag may be set to zero before the application program is started.
That is, when the application program is started but no page is opened, the value of the preset variable flag is zero, and with the start of the application program, the initial page or the main page is opened, at this time, the plus-one processing is started to be performed on the preset variable flag, and then the corresponding plus-one processing and minus-one processing are performed according to the page change.
In another possible implementation manner, when the application program is started and an initial page or a home page is opened, the preset variable flag is assigned to be one, and then corresponding plus and minus processes are executed according to page changes.
In practical applications, as the application program runs, the visible state of one page and the invisible state of another page usually appear in pairs, so as long as one page is in the visible state, the value of the preset variable flag will not be equal to zero, and as long as one page is in the visible state, it indicates that the application program is in the foreground state.
Therefore, in the embodiment of the present disclosure, step S102 includes:
when the value of the preset variable mark is non-zero, determining that the application program is in a foreground state;
and when the value of the preset variable mark is zero, determining that the application program is in a background state.
In general, it may be determined that the application program is in the foreground state directly when the value of the preset variable flag is one.
In a special case, for example, in a terminal having an application differentiation function, two or more identical applications may be executed at the same time, and at this time, it is necessary to determine that an application is in a foreground state when the value of the preset variable flag is any positive integer other than zero.
In practical application, the amount of the value of the preset variable flag may be determined according to other scenes capable of opening multiple pages to determine that the application program is in the foreground state.
The embodiment of the present disclosure further provides a feasible implementation manner, when a first page in an application program enters a visible state, after performing an addition process on a preset variable flag, recording a state of the first page.
And when a second page in the application program enters an invisible state, recording the state of the second page after executing subtraction processing on the preset variable mark.
That is, after the preset variable flag is subjected to plus-minus processing, the state of the corresponding page in the processing process needs to be recorded.
In practical application, when the application program has problems such as crash and flash back, or when the value of the preset variable mark has an error, the process of the occurrence of the problem or the error can be traced back according to the recorded page state, which is beneficial to the optimization of the application program. In other scenarios, the running process of the application program can be tracked according to the record.
The embodiment of the present disclosure further provides a feasible implementation manner, and after determining that the application program is in a foreground state, the implementation manner further includes the following steps: pages in the application that are in a visible state are determined. And then, corresponding processing can be executed on the page in the visible state, and the page displayed on the page can be known by the user due to the foreground state of the application program, so that the method and the device are particularly suitable for application scenes with strong interactivity.
In practical application, the above scheme can also be applied to the following functional scenarios:
(1) in an instant chat scene, if an application program is running in the foreground, the user is shown to be paying attention to chat contents in real time, and the user does not need to be reminded when receiving a new message, so that the user is prevented from being disturbed. If the application program is running in the background, the application program can remind or push the user in time when receiving a new message, so that the instantaneity of chatting is ensured.
(2) In a live video scene, some special effects may appear according to the operation of a user, if an application program is running in the foreground, the user can watch the special effects, and then the special effects can be displayed, so that the watching effect of the user is ensured. If the application program is running in the background, the special effects cannot be observed by the user, and the special effects are not displayed so as to reduce power consumption.
(3) In entertainment scenes such as games and the like, in order to ensure healthy entertainment experience, a user with overlong use time needs to be reminded, if the detected time reaches the preset time, the application program runs in the foreground, the reminder is sent immediately, and if the application program runs in the background, the reminder indicates that the user probably has been at rest, and the reminder does not need to be sent. In addition, in this scenario, it may also be detected whether the usage time is too long in combination with the above recording of the page state, for example, if the value of the preset variable flag is always non-zero within a predetermined time, or the number of times and time of occurrence of zero are small, it is determined that the user has too long the game time.
It will be appreciated by those skilled in the art that the foregoing scenarios are merely examples, and that suitable variations based on these examples are also applicable to the present disclosure and are intended to be included within the scope of the present disclosure.
According to the method for judging the foreground and background states of the application program, the value of the preset variable mark is obtained, and the preset variable mark is updated in real time based on the visible state and the invisible state of each page of the application program; according to the value of the preset variable mark, the foreground and background states of the application program can be quickly determined, so that different functions can be respectively realized aiming at the foreground state and the background state of the application program, and the performance of the application program is improved.
The embodiment of the present disclosure further provides a device for determining a foreground and background state of an application, as shown in fig. 2, the determining device 20 may include: an obtaining module 201 and a determining module 202, wherein,
the obtaining module 201 is configured to obtain a value of a preset variable flag, where the preset variable flag is updated in real time based on a visible state and an invisible state of each page of the application program;
the determining module 202 is configured to determine foreground and background states of the application according to a value of a preset variable flag.
In an optional implementation manner, the determining module 202 is specifically configured to determine that the application program is in a foreground state when the value of the preset variable flag is non-zero; and when the value of the preset variable mark is zero, determining that the application program is in a background state.
In an optional implementation, the apparatus further includes:
the updating module is used for performing addition processing on the preset variable mark when a first page in the application program enters a visible state; and when the second page in the application program enters an invisible state, executing subtraction processing on the preset variable mark.
In an alternative implementation, the first page entering the visible state includes any one of:
opening a first page;
jumping to the first page from other pages;
returning to the first page from the other pages opened on the first page.
In an alternative implementation, the second page entering the invisible state includes any of the following:
closing the second page;
opening other pages in the second page;
and opening other application programs on the second page.
In an optional implementation manner, the update module is further configured to record a state of the first page after performing an addition process on the preset variable flag; and recording the state of the second page after executing the one-down processing on the preset variable mark.
In an alternative implementation, the value of the default variable flag is zero before the application is started.
In an optional implementation, the apparatus further includes:
and the determining module is used for determining the page in the visible state in the application program after determining that the application program is in the foreground state.
The device for determining the foreground and background states of an application provided in the embodiment of the present disclosure may be specific hardware on a device or software or firmware installed on the device, and the implementation principle and the resulting technical effects are the same as those of the foregoing method embodiment.
The device for judging the foreground and background states of the application program, provided by the embodiment of the disclosure, is used for updating the preset variable flag in real time based on the visible state and the invisible state of each page of the application program by acquiring the value of the preset variable flag; according to the value of the preset variable mark, the foreground and background states of the application program can be quickly determined, so that different functions can be respectively realized aiming at the foreground state and the background state of the application program, and the performance of the application program is improved.
Based on the same principle as the method for determining the foreground and background states of the application program in the embodiment of the present disclosure, an embodiment of the present disclosure further provides an electronic device, where the electronic device includes a memory and a processor, the memory stores at least one instruction, at least one program, a code set, or an instruction set, and the processor loads the at least one instruction, the at least one program, the code set, or the instruction set and executes the method shown in any one of the above embodiments of the present disclosure.
Based on the same principle as the method for determining the foreground and background states of an application program in the embodiment of the present disclosure, a computer-readable storage medium is also provided in the embodiment of the present disclosure, and the computer-readable storage medium is used for storing a computer instruction, a program, a code set, or an instruction set, and when the computer-readable storage medium runs on a computer, the computer is enabled to execute the method shown in any one of the above embodiments of the present disclosure.
Referring now to fig. 3, a schematic diagram of an electronic device (e.g., a terminal device corresponding to fig. 1) 30 suitable for implementing embodiments of the present disclosure is shown. The electronic devices in the embodiments of the present disclosure may include, but are not limited to, mobile terminals such as mobile phones, notebook computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), in-vehicle terminals (e.g., car navigation terminals), and the like, and fixed terminals such as digital TVs, desktop computers, and the like. The electronic device shown in fig. 3 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present disclosure.
As shown in fig. 3, the electronic device 30 may include a processing means (e.g., a central processing unit, a graphics processor, etc.) 301 that may perform various appropriate actions and processes in accordance with a program stored in a Read Only Memory (ROM)302 or a program loaded from a storage means 308 into a Random Access Memory (RAM) 303. In the RAM 303, various programs and data necessary for the operation of the electronic apparatus 30 are also stored. The processing device 301, the ROM302, and the RAM 303 are connected to each other via a bus 304. An input/output (I/O) interface 305 is also connected to bus 304.
Generally, the following devices may be connected to the I/O interface 305: input devices 306 including, for example, a touch screen, touch pad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; an output device 307 including, for example, a Liquid Crystal Display (LCD), a speaker, a vibrator, and the like; storage devices 308 including, for example, magnetic tape, hard disk, etc.; and a communication device 309. The communication means 309 may allow the electronic device 30 to communicate wirelessly or by wire with other devices to exchange data. While fig. 3 illustrates an electronic device 30 having various means, it is to be understood that not all illustrated means are required to be implemented or provided. More or fewer devices may alternatively be implemented or provided.
In particular, according to an embodiment of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication means 309, or installed from the storage means 308, or installed from the ROM 302. The computer program, when executed by the processing device 301, performs the above-described functions defined in the methods of the embodiments of the present disclosure.
It should be noted that the computer readable medium in the present disclosure can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present disclosure, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In contrast, in the present disclosure, a computer readable signal medium may comprise a propagated data signal with computer readable program code embodied therein, either in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, optical cables, RF (radio frequency), etc., or any suitable combination of the foregoing.
The computer readable medium may be embodied in the electronic device; or may exist separately without being assembled into the electronic device.
The computer readable medium carries one or more programs which, when executed by the electronic device, cause the electronic device to: acquiring the value of a preset variable mark, wherein the preset variable mark is updated in real time based on the visible state and the invisible state of each page of the application program; and determining the foreground and background states of the application program according to the value of the preset variable mark.
Computer program code for carrying out operations for aspects of the present disclosure may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C + +, and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units described in the embodiments of the present disclosure may be implemented by software or hardware. Where the name of a unit does not in some cases constitute a limitation of the unit itself, for example, the first retrieving unit may also be described as a "unit for retrieving at least two internet protocol addresses".
The foregoing description is only exemplary of the preferred embodiments of the disclosure and is illustrative of the principles of the technology employed. It will be appreciated by those skilled in the art that the scope of the disclosure herein is not limited to the particular combination of features described above, but also encompasses other embodiments in which any combination of the features described above or their equivalents does not depart from the spirit of the disclosure. For example, the above features and (but not limited to) the features disclosed in this disclosure having similar functions are replaced with each other to form the technical solution.
It should be understood that, although the steps in the flowcharts of the figures are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not performed in the exact order shown and may be performed in other orders unless explicitly stated herein. Moreover, at least a portion of the steps in the flow chart of the figure may include multiple sub-steps or multiple stages, which are not necessarily performed at the same time, but may be performed at different times, which are not necessarily performed in sequence, but may be performed alternately or alternately with other steps or at least a portion of the sub-steps or stages of other steps.
The foregoing is only a partial embodiment of the present disclosure, and it should be noted that, for those skilled in the art, various modifications and decorations can be made without departing from the principle of the present disclosure, and these modifications and decorations should also be regarded as the protection scope of the present disclosure.

Claims (11)

1. A method for judging foreground and background states of an application program is characterized by comprising the following steps:
acquiring the value of a preset variable mark, wherein the preset variable mark is updated in real time based on the visible state and the invisible state of each page of the application program;
and determining the foreground and background states of the application program according to the value of the preset variable mark.
2. The method according to claim 1, wherein the determining the foreground and background states of the application according to the value of the preset variable flag comprises:
when the value of the preset variable mark is non-zero, determining that the application program is in a foreground state;
and when the value of the preset variable mark is zero, determining that the application program is in a background state.
3. The method according to claim 1 or 2, wherein the updating of the preset variable flag in real time based on the visible state and the invisible state of each page of the application program comprises:
when a first page in the application program enters a visible state, executing addition processing on a preset variable mark;
and when a second page in the application program enters an invisible state, executing subtraction processing on the preset variable mark.
4. The method according to claim 3, wherein the first page entering the visible state includes any one of:
opening the first page;
jumping from other pages to the first page;
returning to the first page from other pages opened on the first page.
5. The method according to claim 3, wherein the second page entering the invisible state comprises any of:
closing the second page;
opening other pages in the second page;
and opening other application programs on the second page.
6. The judgment method according to claim 3,
after the adding one process is executed to the preset variable mark, the method further comprises the following steps:
recording the state of the first page;
after the performing a subtraction process on the preset variable flag, the method further includes:
and recording the state of the second page.
7. The method according to claim 3, wherein the value of the flag is zero before the application program is started.
8. The method according to claim 2, wherein after determining that the application program is in a foreground state, further comprising:
determining a page in a visible state in the application.
9. An apparatus for determining a foreground/background status of an application, comprising:
the acquisition module is used for acquiring the value of a preset variable mark, and the preset variable mark is updated in real time based on the visible state and the invisible state of each page of the application program;
and the judging module is used for determining the foreground and background states of the application program according to the value of the preset variable mark.
10. An electronic device, comprising:
a processor and a memory, the memory storing at least one instruction, at least one program, a set of codes, or a set of instructions, the at least one instruction, the at least one program, the set of codes, or the set of instructions being loaded and executed by the processor to implement the method of any of claims 1-8.
11. A computer-readable storage medium for storing a computer instruction, a program, a set of codes, or a set of instructions, which, when run on a computer, causes the computer to perform the method of any one of claims 1-8.
CN201811626434.7A 2018-12-28 2018-12-28 Method and device for judging foreground and background states of application program and electronic equipment Pending CN111382025A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811626434.7A CN111382025A (en) 2018-12-28 2018-12-28 Method and device for judging foreground and background states of application program and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811626434.7A CN111382025A (en) 2018-12-28 2018-12-28 Method and device for judging foreground and background states of application program and electronic equipment

Publications (1)

Publication Number Publication Date
CN111382025A true CN111382025A (en) 2020-07-07

Family

ID=71215004

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811626434.7A Pending CN111382025A (en) 2018-12-28 2018-12-28 Method and device for judging foreground and background states of application program and electronic equipment

Country Status (1)

Country Link
CN (1) CN111382025A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112711467A (en) * 2020-12-17 2021-04-27 北京科银京成技术有限公司 Partition timeout processing method and device, computer equipment and storage medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105022955A (en) * 2014-04-22 2015-11-04 腾讯科技(深圳)有限公司 Locking method and mobile terminal of application program
US20150355801A1 (en) * 2014-06-05 2015-12-10 International Business Machines Corporation Recorded history feature in operating system windowing system
CN106126392A (en) * 2016-06-30 2016-11-16 乐视控股(北京)有限公司 The determination methods of a kind of AM/BAM application program and device
CN106371977A (en) * 2016-09-02 2017-02-01 中科信息安全共性技术国家工程研究中心有限公司 Method for detecting whether current application positioned on foreground or not
CN107608741A (en) * 2017-08-15 2018-01-19 深圳市沃特沃德股份有限公司 The method for closing and device of application program
CN108153646A (en) * 2017-12-26 2018-06-12 北京酷我科技有限公司 A kind of method of general monitoring Android front and backs

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105022955A (en) * 2014-04-22 2015-11-04 腾讯科技(深圳)有限公司 Locking method and mobile terminal of application program
US20150355801A1 (en) * 2014-06-05 2015-12-10 International Business Machines Corporation Recorded history feature in operating system windowing system
CN106126392A (en) * 2016-06-30 2016-11-16 乐视控股(北京)有限公司 The determination methods of a kind of AM/BAM application program and device
CN106371977A (en) * 2016-09-02 2017-02-01 中科信息安全共性技术国家工程研究中心有限公司 Method for detecting whether current application positioned on foreground or not
CN107608741A (en) * 2017-08-15 2018-01-19 深圳市沃特沃德股份有限公司 The method for closing and device of application program
CN108153646A (en) * 2017-12-26 2018-06-12 北京酷我科技有限公司 A kind of method of general monitoring Android front and backs

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112711467A (en) * 2020-12-17 2021-04-27 北京科银京成技术有限公司 Partition timeout processing method and device, computer equipment and storage medium
CN112711467B (en) * 2020-12-17 2023-10-10 北京科银京成技术有限公司 Partition timeout processing method, partition timeout processing device, computer equipment and storage medium

Similar Documents

Publication Publication Date Title
CN109618177B (en) Video processing method and device, electronic equipment and computer readable storage medium
CN109640188B (en) Video preview method and device, electronic equipment and computer readable storage medium
CN112261226B (en) Horizontal screen interaction method and device, electronic equipment and storage medium
CN111930973B (en) Multimedia data playing method and device, electronic equipment and storage medium
CN110365973B (en) Video detection method and device, electronic equipment and computer readable storage medium
CN109684589B (en) Client comment data processing method and device and computer storage medium
CN109600656B (en) Video list display method and device, terminal equipment and storage medium
CN111459598B (en) Information display method and device, electronic equipment and storage medium
CN111790148B (en) Information interaction method and device in game scene and computer readable medium
CN113721807B (en) Information display method and device, electronic equipment and storage medium
CN111309225B (en) Screen clearing processing method and device
CN112395022A (en) Information display method and device, electronic equipment and computer readable storage medium
CN110267088B (en) Video playing control method and device, electronic equipment and storage medium
CN110134480B (en) User trigger operation processing method and device, electronic equipment and storage medium
US11689757B2 (en) Method and apparatus for providing video streams
US20230421857A1 (en) Video-based information displaying method and apparatus, device and medium
CN110414625B (en) Method and device for determining similar data, electronic equipment and storage medium
CN111382025A (en) Method and device for judging foreground and background states of application program and electronic equipment
CN110147283B (en) Display content switching display method, device, equipment and medium
CN110134905B (en) Page update display method, device, equipment and storage medium
CN113766303B (en) Multi-screen interaction method, device, equipment and storage medium
CN115563134A (en) Interaction method, interaction device, electronic equipment and computer readable medium
CN112203103B (en) Message processing method, device, electronic equipment and computer readable storage medium
CN111274513B (en) Window display method, device, terminal and storage medium
CN112162682A (en) Content display method and device, electronic equipment and computer readable storage medium

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
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20200707