CN112286652A - Android APP background keep-alive method - Google Patents
Android APP background keep-alive method Download PDFInfo
- Publication number
- CN112286652A CN112286652A CN202010980046.XA CN202010980046A CN112286652A CN 112286652 A CN112286652 A CN 112286652A CN 202010980046 A CN202010980046 A CN 202010980046A CN 112286652 A CN112286652 A CN 112286652A
- Authority
- CN
- China
- Prior art keywords
- wallpaper
- app
- application
- service
- user
- 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.)
- Withdrawn
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/48—Program initiating; Program switching, e.g. by interrupt
- G06F9/4806—Task transfer initiation or dispatching
- G06F9/4843—Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
- G06F9/485—Task life-cycle, e.g. stopping, restarting, resuming execution
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F21/00—Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
- G06F21/50—Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems
- G06F21/52—Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems during program execution, e.g. stack integrity ; Preventing unwanted data erasure; Buffer overflow
- G06F21/54—Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems during program execution, e.g. stack integrity ; Preventing unwanted data erasure; Buffer overflow by adding security routines or objects to programs
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F21/00—Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
- G06F21/50—Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems
- G06F21/55—Detecting local intrusion or implementing counter-measures
- G06F21/554—Detecting local intrusion or implementing counter-measures involving event detection and direct action
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Computer Security & Cryptography (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Computer Hardware Design (AREA)
- Telephone Function (AREA)
Abstract
The invention discloses a method for keeping android APP alive at background, which comprises the following steps: when a user enters App under a 'wallpaper guard' keep-alive mechanism, the application can automatically judge whether proxy system wallpaper service exists; if not, the App actively pops the window to prompt the user to start the wallpaper guard function, so that the user can select the wallpaper. Compared with the method for realizing continuous running of the App by mutual pulling of the two-process service in the prior art, the wallpaper guard function directly bypasses the solution and provides the wallpaper service for the system, so that the corresponding effect is achieved, the mobile phone has the wallpaper function, the attached APP popup window can be written into any APP, the incompatible condition of the two-process guard on a new-version mobile phone is solved, the method is suitable for all scenes where the App needs to be kept alive, and when the wallpaper guard runs on the background, the memory consumption is low, the probability of being cleaned is low, and the code logic is clearer.
Description
Technical Field
The invention relates to the technical field of APP keep-alive, in particular to a method for keeping android APP alive at background.
Background
The android application runs and is cleaned up by a system in the background, some apps in the traditional keep-alive mode are particularly sensitive to the geographic position of a user, the geographic position of each user needs to be uploaded to a server once in 5 minutes, and the apps are executed in the background all the time according to the common method. In order to ensure that the App can be well kept alive and not killed by a background, a common strategy is dual-process protection, and Service of two processes are mutually protected; when a Service of one process hangs, a Service of another process is responsible for restarting the hung-up Service. Before this, an aid dl interface is defined to ensure that two different process services are bound to each other for communication.
The existing android APP background keep-alive method still has the defects that the continuous running of the App is realized by mutual pulling of dual-process services, but under the optimization of a mobile phone system and an android version, the mode can not adapt to all mobile phones and can not guarantee the stability of the App running under the mechanism completely, so that the universal applicability and the stability of the android APP background keep-alive method are reduced, and meanwhile, a user can not obtain better experience and lower mobile phone energy consumption,
disclosure of Invention
The invention aims to solve the problems and provides a method for keeping android APP alive at the background.
In order to achieve the purpose, the invention adopts the following technical scheme:
a method of background keep-alive for android APP, the method comprising:
when a user enters App under a 'wallpaper guard' keep-alive mechanism, the application can automatically judge whether proxy system wallpaper service exists;
if not, the App actively pops the window to prompt the user to start a wallpaper guard function, so that the user can select the wallpaper;
after the user finishes the selection, the App sets system wallpaper, and the App can replace the system to provide wallpaper service;
when the user is on the screen and cleaned, the system can automatically list the application providing the wallpaper service as a white list, the application cannot be killed, and meanwhile, when the user restarts the mobile phone, the application can be started to provide the wallpaper function, so that the background keep-alive of the android APP is realized.
As a further description of the above technical solution:
the self-judging module comprises the following steps:
the method comprises the following steps: adding permissions required by wallpaper setting by an application;
step two: the method comprises the steps that an application program inherits a wallpaper Service, inherits the wallpaper default setting of an android system, the Service can be started only by one application or the system, when a user enters the application, whether the wallpaper Service of the application is started or not is judged, if the Service is not started, the App does not perform a system wallpaper function in an agency mode, a popup window is displayed to prompt that 'wallpaper guard' is started, and if the Service is started, the fact that the App calls a systemRunning function of the wallpaper Service at the moment to really run the wallpaper Service is proved.
Step three: entering a 'wallpaper guard' function, firstly calling a wallpaper selection function of the system for a user to select wallpaper, and setting the wallpaper into wallpaper by a setBitmap method of a Wallpaermanager object after the wallpaper selection is finished;
step four: and after the setting is finished, returning to the application of the user from the wallpaper preview page, and successfully providing a function for the system agent to implement the wallpaper.
As a further description of the above technical solution:
the wallpaper is selected to be uploaded locally and downloaded online.
As a further description of the above technical solution:
the APP active popup may be adapted for any APP.
As a further description of the above technical solution:
the wallpaper service itself is white-listed in the android system, so APPs using wallpaper functionality will also be recognized by the system as white-listed.
As a further description of the above technical solution:
in the fourth step, two callbacks exist when the wallpaper preview page is returned to the application, the first call back is that the wallpaper setting fails, the application prompts the user to perform wallpaper guard again, and the second call back is that the application directly sets the wallpaper successfully.
In summary, due to the adoption of the technical scheme, the invention has the beneficial effects that:
compared with the method for realizing continuous running of the App by mutual pulling of the two-process service in the prior art, the wallpaper guard function directly bypasses the solution and provides the wallpaper service for the system, so that the corresponding effect is achieved, the mobile phone has the wallpaper function, the attached APP popup window can be written into any APP, the incompatible condition of the two-process guard on a new-version mobile phone is solved, the method is suitable for all scenes where the App needs to be kept alive, and when the wallpaper guard runs on the background, the memory consumption is low, the probability of being cleaned is low, and the code logic is clearer.
Drawings
FIG. 1 is a block diagram of the process of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The first embodiment is as follows:
referring to fig. 1, a first embodiment:
a method for keeping android APP alive at background comprises the following steps:
when a user enters App under a 'wallpaper guard' keep-alive mechanism, the application can automatically judge whether proxy system wallpaper service exists; keep-alive is the pain point problem of android tool apps, and the wallpaper guard indicated in the scheme is a code number of a keep-alive mechanism required to be protected in the scheme;
the self-judging module comprises the following steps:
the method comprises the following steps: adding permissions required by wallpaper setting by an application;
step two: the method comprises the steps that an application program inherits a wallpaper Service, inherits the wallpaper default setting of an android system, the Service can be started only by one application or the system, when a user enters the application, whether the wallpaper Service of the application is started or not is judged, if the Service is not started, the App does not perform a system wallpaper function in an agency mode, a popup window is displayed to prompt that 'wallpaper guard' is started, and if the Service is started, the fact that the App calls a systemRunning function of the wallpaper Service at the moment to really run the wallpaper Service is proved.
Step three: entering a 'wallpaper guard' function, firstly calling a wallpaper selection function of the system for a user to select wallpaper, and setting the wallpaper into wallpaper by a setBitmap method of a Wallpaermanager object after the wallpaper selection is finished;
step four: and after the setting is finished, returning to the application from the wallpaper setting preview page to successfully provide a function for the system agent to execute the wallpaper, wherein two callbacks exist in the step four when returning to the application from the wallpaper setting preview page, the first type is failure in setting the wallpaper, the application can prompt the user to perform wallpaper guard again, and the second type is success in directly setting the wallpaper by the application.
If not, the App actively pops the window to prompt the user to start the wallpaper guard function, the user can select the wallpaper, the wallpaper can be selected to be uploaded locally and downloaded online, and the APP actively pops the window to be suitable for any APP;
after the user finishes the selection, the App sets system wallpaper, and the App can replace the system to provide wallpaper service;
when a user is on the screen and cleaned, the system can automatically list the application providing the wallpaper service as a white list, the wallpaper service is listed in the white list of the android system, the APP using the wallpaper function can be identified as the white list by the system, the application cannot be killed, and meanwhile, when the user restarts the mobile phone, the application can be started to provide the wallpaper function at first, so that background keep-alive of the android APP is realized.
Compared with the method for realizing continuous running of the App by mutual pulling of the two-process service in the prior art, the wallpaper guard function directly bypasses the solution and provides wallpaper service for the system, so that the corresponding effect is achieved, the mobile phone has the wallpaper function, the subsidiary APP popup window can be written into any APP, the problem that the two-process guard is not compatible with a new version mobile phone and is suitable for all App scenes needing to be kept alive is solved, and when the wallpaper guard runs on the background, the memory consumption is low, the probability of being cleaned is low, and the code logic is clearer.
The above description is only for the preferred embodiment of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art should be considered to be within the technical scope of the present invention, and the technical solutions and the inventive concepts thereof according to the present invention should be equivalent or changed within the scope of the present invention.
Claims (6)
1. A method for keeping android APP alive at background is characterized by comprising the following steps:
when a user enters App under a 'wallpaper guard' keep-alive mechanism, the application can automatically judge whether proxy system wallpaper service exists;
if not, the App actively pops the window to prompt the user to start a wallpaper guard function, so that the user can select the wallpaper;
after the user finishes the selection, the App sets system wallpaper, and the App can replace the system to provide wallpaper service;
when the user is on the screen and cleaned, the system can automatically list the application providing the wallpaper service as a white list, the application cannot be killed, and meanwhile, when the user restarts the mobile phone, the application can be started to provide the wallpaper function, so that the background keep-alive of the android APP is realized.
2. The method for background keep-alive of android APP as recited in claim 1, wherein the self-determination module comprises the following steps:
the method comprises the following steps: adding permissions required by wallpaper setting by an application;
step two: the method comprises the steps that an application program inherits a wallpaper Service, inherits the wallpaper default setting of an android system, the Service can be started only by one application or the system, when a user enters the application, whether the wallpaper Service of the application is started or not is judged, if the Service is not started, the App does not perform a system wallpaper function in an agency mode, a popup window is displayed to prompt that 'wallpaper guard' is started, and if the Service is started, the fact that the App calls a systemRunning function of the wallpaper Service at the moment to really run the wallpaper Service is proved.
Step three: entering a 'wallpaper guard' function, firstly calling a wallpaper selection function of the system for a user to select wallpaper, and setting the wallpaper into wallpaper by a setBitmap method of a Wallpaermanager object after the wallpaper selection is finished;
step four: and after the setting is finished, returning to the application of the user from the wallpaper preview page, and successfully providing a function for the system agent to implement the wallpaper.
3. The method of claim 1, wherein the wallpaper is selectable for local upload and online download.
4. The method of claim 1, wherein the APP active popup can be adapted to any APP.
5. The method for background keep-alive of android APP as claimed in claim 1, wherein the wallpaper service itself is whitelisted in an android system, so that APP using wallpaper function can also be recognized as whitelisted by the system.
6. The method for keeping android APP alive at background as claimed in claim 2, wherein in the fourth step, two callbacks exist from setting a wallpaper preview page to the application of the application, the first type is failure in setting wallpaper, the application prompts the user to perform wallpaper guard again, and the second type is success in directly setting wallpaper by the application.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010980046.XA CN112286652A (en) | 2020-09-17 | 2020-09-17 | Android APP background keep-alive method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010980046.XA CN112286652A (en) | 2020-09-17 | 2020-09-17 | Android APP background keep-alive method |
Publications (1)
Publication Number | Publication Date |
---|---|
CN112286652A true CN112286652A (en) | 2021-01-29 |
Family
ID=74419917
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010980046.XA Withdrawn CN112286652A (en) | 2020-09-17 | 2020-09-17 | Android APP background keep-alive method |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112286652A (en) |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112860408A (en) * | 2021-03-03 | 2021-05-28 | 苏州沁游网络科技有限公司 | Process keep-alive method, device and system in cloud reality machine and storage medium |
CN112988282A (en) * | 2021-04-27 | 2021-06-18 | 荣耀终端有限公司 | Application keep-alive method and terminal equipment |
CN113656105A (en) * | 2021-08-19 | 2021-11-16 | 天津车之家数据信息技术有限公司 | Keep-alive processing method for enterprise application, mobile terminal and storage medium |
CN114296854A (en) * | 2021-12-28 | 2022-04-08 | 珠海豹趣科技有限公司 | Desktop wallpaper display method and device, electronic equipment and readable storage medium |
-
2020
- 2020-09-17 CN CN202010980046.XA patent/CN112286652A/en not_active Withdrawn
Cited By (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112860408A (en) * | 2021-03-03 | 2021-05-28 | 苏州沁游网络科技有限公司 | Process keep-alive method, device and system in cloud reality machine and storage medium |
CN112988282A (en) * | 2021-04-27 | 2021-06-18 | 荣耀终端有限公司 | Application keep-alive method and terminal equipment |
CN112988282B (en) * | 2021-04-27 | 2021-08-20 | 荣耀终端有限公司 | Application keep-alive method and terminal equipment |
CN113656105A (en) * | 2021-08-19 | 2021-11-16 | 天津车之家数据信息技术有限公司 | Keep-alive processing method for enterprise application, mobile terminal and storage medium |
CN113656105B (en) * | 2021-08-19 | 2024-02-23 | 天津车之家数据信息技术有限公司 | Keep-alive processing method for enterprise application, mobile terminal and storage medium |
CN114296854A (en) * | 2021-12-28 | 2022-04-08 | 珠海豹趣科技有限公司 | Desktop wallpaper display method and device, electronic equipment and readable storage medium |
CN114296854B (en) * | 2021-12-28 | 2024-04-26 | 珠海豹趣科技有限公司 | Desktop wallpaper display method and device, electronic equipment and readable storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN112286652A (en) | Android APP background keep-alive method | |
US9256479B2 (en) | App icon processing method and communication terminal | |
CN104991803B (en) | To the managing and control system and method for the self-starting under given conditions of android application programs | |
CN102883048B (en) | In-car Bluetooth communication method and in-car Bluetooth communication device based on Android operating system | |
CN103473502A (en) | Method and system for acquiring Root rights of android-based mobile terminal | |
CN105786519B (en) | Android device program management method and android device | |
CN105677477A (en) | Method and device for optimizing application program resources and electronic equipment | |
CN114116056A (en) | Page display method and device | |
CN110502324B (en) | Processing method, system and storage medium for restart data of cloud mobile phone game | |
CN106843977B (en) | A kind of processing method, device and the mobile terminal of application program self-starting | |
CN106874086B (en) | A kind of processing method, device and the mobile terminal of application program self-starting | |
CN105653934A (en) | Mobile terminal and application protection method thereof | |
CN107943270A (en) | Control method, device and the storage medium and mobile terminal of application service | |
CN112445530B (en) | Method and device for keeping third-party application program alive | |
CN104102498B (en) | A kind of mobile terminal and its starting-up method | |
CN102612136A (en) | Method and device for restarting communication in case of registration failure of identification SIM (subscriber identity module) card of customer | |
CN112752258B (en) | eSIM card opening method, mobile phone terminal and service acceptance system | |
CN108509263A (en) | A kind of background process management method and system | |
CN106055396A (en) | Application management method and terminal | |
CN101827330A (en) | Short message pushing and optimizing method of mobile terminal and device thereof | |
CN108958808A (en) | Method for starting terminal and device, terminal and storage medium | |
CN108494951B (en) | Unread data acquisition method, unread data acquisition device, unread data acquisition equipment and storage medium | |
WO2017206620A1 (en) | Method and apparatus for setting state of application program | |
EP3011445A1 (en) | Dual-bank telecommunication apparatus and method of upgrading firmware in dual-bank telecommunication apparatus | |
CN113434234A (en) | Page jump method, device, computer readable storage medium and processor |
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 | ||
WW01 | Invention patent application withdrawn after publication |
Application publication date: 20210129 |
|
WW01 | Invention patent application withdrawn after publication |