CN-115686679-B - Application self-starting method based on android device
Abstract
The present invention discloses an application self starting method based on Android devices. The method modifies the Android system code to add a custom service class in the launcher of the system source code, and modifies the source code of the launcher startup part. After the launcher is launched, the newly added custom service is launched to monitor the running and installation status of the custom application, overcoming the problem of the application not being able to self start after startup and upgrade. By modifying the source code of the launcher in the Android system, the running and installation status of the application is monitored in real time, achieving self starting effects upon startup, self starting after upgrade, and other non running states.
Inventors
- Wei Zhaodu
- CHEN HONG
- QIN YI
- HUANG RENPING
- WANG JIANWEI
- TANG JIAMING
- ZHOU MING
- HUI JIAN
- TANG JIANGHUA
Assignees
- 桂林海威科技股份有限公司
Dates
- Publication Date
- 20260508
- Application Date
- 20221114
Claims (1)
- 1. An application self-starting method based on android equipment is characterized by comprising the following steps: 1) Adding a custom service class and a service proxy class in a Launcher folder of the android system source code, and judging whether the custom service is started or not by using the service proxy class in a starting code of the Launcher after the intelligent equipment is started, and if the custom service is not started, starting the custom service in the Launcher; 2) In the self-defined service, monitoring the self-defined application, acquiring all application program information through an application program package management class, and inquiring whether the self-defined application is installed or not through traversing and comparing package names; 3) If the custom application is not installed, skipping the monitoring, setting delay time, returning to the step 2), and continuously monitoring the running state of the custom android application; 4) If the custom application is already installed, judging whether the custom application is already started or not by acquiring the activity management class and traversing the judging stack information; 5) If the custom application is started, acquiring a stack top page through an acquisition process management class, judging whether a current page of a foreground is operated in the foreground, if so, setting delay time, returning to the step 2), and continuously monitoring the operation state of the custom android application; 6) If the user-defined application is not operated in the foreground, the user-defined application is placed in the foreground for display through the Intent; 7) Through the steps 2) to 6), the custom application is installed, operated and placed in the foreground for display, the monitoring is skipped, and the installation state and the operation state of the custom application are re-monitored after the set delay time.
Description
Application self-starting method based on android device Technical Field The invention relates to the technical field of android intelligent equipment, in particular to an application self-starting method based on android equipment. Background At present, the existing android system-based device sends out a boot_complete broadcast when being started, and an application can be started after receiving the boot_complete broadcast, but because the application is not a system application and cannot be installed under a system/app, but is installed in a storage card, the loading speed is unstable, and the BOOT cannot be automatically started due to the fact that the loading speed is not stable and the BOOT cannot be loaded well before the boot_complete broadcast is sent out by the system. Meanwhile, in the existing android application, after the coverage installation and upgrading are performed, the action_ PACKAGE _ REPLACED broadcast sent by the monitoring system is monitored, and in the An Zhuogao version of system, the broadcast cannot be monitored through static registration, and can only be monitored through dynamic registration when the application runs. However, an application installed in an overlay will stop running in the process of upgrading, and the dynamically registered monitor will also stop, so that the broadcast of the application upgrade itself cannot be monitored, and thus the application cannot be started after upgrading. Disclosure of Invention The invention aims to overcome the defects in the background technology and provide an application self-starting method based on android equipment. The technical scheme for realizing the aim of the invention is as follows: an application self-starting method based on android equipment specifically comprises the following steps: 1) Adding a custom service class and a service proxy class in a Launcher folder of the android system source code, and judging whether the custom service is started or not by using the service proxy class in a starting code of the Launcher after the intelligent equipment is started, and if the custom service is not started, starting the custom service in the Launcher; 2) In the custom service, monitoring the custom application, acquiring all application program information by acquiring an application package name management class, and inquiring whether the custom application is installed or not by traversing comparison registration; 3) If the custom application is not installed, skipping the monitoring, setting delay time, returning to the step 2), and continuously monitoring the running state of the custom android application; 4) If the custom application is already installed, acquiring an activity management class, judging stack information through traversal, and judging whether the custom application is already started or not; 5) If the custom application is started, acquiring a stack top page through a process management class, judging whether a current foreground page is operated in the foreground, if so, setting delay time, returning to the step 2), and continuously monitoring the operation state of the custom android application; 6) If the user-defined application is not operated in the foreground, the user-defined application is placed in the foreground for display through the Intent; 7) Through the steps 2) to 6), the custom application is installed, operated and placed in the foreground for display, the monitoring is skipped, and the installation state and the operation state of the custom application are re-monitored after the set delay time. The method for automatically starting the application based on the android device solves the problem that the application cannot be automatically started after being started and upgraded, and monitors the running state and the installation state of the application in real time by modifying the source code of the Launcher in the android system, so that the self-starting effect of starting after starting, self-starting after upgrading and other non-running states is achieved. Drawings Fig. 1 is a flowchart of an application self-starting method based on android devices. Detailed Description The present invention will now be further illustrated with reference to the drawings and examples, but is not limited thereto. As shown in FIG. 1, the method comprises the steps of modifying android system codes, adding a custom service class in a Launcher of system source codes, modifying the source codes of a Launcher starting part, and starting the newly added custom service after the Launcher is started to monitor the running state and the installation state of the custom application, wherein the method comprises the following specific steps: 1) Adding a custom service class and a service proxy class in a Launcher folder of the android system source code, and judging whether the custom service is started or not by using the service proxy class in a starting code of the Launcher after the in