A method for collecting Android application startup events
By using a real-time detection mechanism for application status and event submission during status changes, the problem of missing OAID or VID in Android application startup events is solved, ensuring data integrity and accuracy.
Patent Information
- Application Number
- CN202210707995.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-21
- Publication Date
- 2025-01-07
- Estimated Expiration
- 2042-06-21
AI Technical Summary
Existing Android application launch event collection suffers from incomplete information, missing OAI or VID, leading to inaccurate statistical data.
By monitoring the application status in real time, using the AppStart and AppEnd countdown mechanisms, and combining oaid_sdk and vid detection, we ensure that the startup event is submitted in a timely manner when the status changes, and retain and resend data when the detection fails.
It effectively prevents the loss of OAI or VID, ensures the integrity of startup event information, and thus improves the completeness and accuracy of statistical data.
Smart Images

Figure CN114968413B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of data collection, and in particular relates to a method for collecting Android application startup events. Background Art
[0002] The collection of Android application startup events can be used for daily activity analysis, retention analysis, function penetration analysis, channel advertising tracking, personalized recommendations, etc.
[0003] The existing collection of Android application startup events has the following main problems: the startup event collection is not comprehensive, and it is easy to lose oaid or lose vid due to delayed vid setting, resulting in inaccurate statistical data. Summary of the invention
[0004] In view of the defects in the prior art, the present invention provides a method for collecting Android application startup events, which can effectively solve the above problems.
[0005] The technical solution adopted by the present invention is as follows:
[0006] The present invention provides a method for collecting Android application startup events, comprising the following steps:
[0007] Step 1, the initial state of the AppStart switch can be triggered to be turned on;
[0008] Step 2, performing real-time status detection on the application to determine whether it is in a foreground running state or a background running state; wherein the application is an Android application;
[0009] When it is detected that the application changes from the foreground running state to the background running state, execute step 3;
[0010] When it is detected that the application changes from the background running state to the foreground running state, execute step 4;
[0011] Step 3, start the AppEnd countdown;
[0012] During the AppEnd countdown of the set time, if it is detected that the application changes from the background running state to the foreground running state, return to step 2; if the application remains in the background running state during the entire AppEnd countdown, when the AppEnd countdown ends, trigger the submission of the application end event AppEnd, set the triggerable AppStart switch to the on state, and then return to step 2;
[0013] Step 4, close the AppEnd countdown; determine the state of the triggerable AppStart switch, if it is in the off state, return to step 2; if it is in the on state, on the one hand, set the triggerable AppStart switch to the off state, return to step 2, on the other hand, trigger the submission of the application startup event AppStart, and then execute step 5;
[0014] Step 5, when triggering the submission of the application start event AppStart, first check whether the application end event AppEnd is successfully submitted after the last submission of the application start event AppStart. If it has been submitted, execute step 6; if not, submit the last application end event AppEnd additionally, and then execute step 6;
[0015] Step 6: Execute the process of submitting the application startup event AppStart. The specific method is as follows:
[0016] Step 6.1, observe the initialization status of oaid_sdk within the set time. The oaid_sdk initialization process is the process of obtaining the anonymous device identifier oaid. When oaid_sdk is initialized successfully, the anonymous device identifier oaid is obtained;
[0017] Step 6.2, write the obtained anonymous device identifier oaid into the application start event AppStart, and submit the application start event AppStart;
[0018] Step 6.3, the application determines whether the device has enabled vid verification. If vid verification has been enabled, a timer with an interval t is set to periodically detect the device identifier vid until the device identifier vid is successfully detected, and then step 6.4 is executed;
[0019] If vid inspection is not enabled, determine whether the device identifier vid can be successfully detected. If so, execute step 6.4. If not, set a timer with an interval time t to periodically and continuously detect the device identifier vid. When the device identifier vid is successfully detected, execute step 6.4. When the detection times reach the set maximum times, if the device identifier vid is still not detected, on the one hand, send the application start event AppStart. On the other hand, retain the data of the application start event AppStart. When the device identifier vid is successfully detected, write the detected device identifier vid into the reserved data of the application start event AppStart, write a resend flag, and then send the reserved application start event AppStart.
[0020] Step 6.4, write the detected device identifier vid into the application start event AppStart, and then send the application start event AppStart.
[0021] Preferably, step 2 is specifically:
[0022] Monitor the number of Activities visible to the application; Activity refers to the interface through which the application interacts with the user;
[0023] When the number of Activities changes from 1 to 0, it is determined that the application changes from the foreground running state to the background running state;
[0024] When the number of Activities changes from 0 to 1, it is determined that the application has changed from the background running state to the foreground running state.
[0025] The method for collecting Android application startup events provided by the present invention has the following advantages:
[0026] The present invention provides a method for collecting Android application startup events, which can effectively solve the problem of losing oaid in the collected startup events or losing vid due to delayed setting of vid, ensure the information integrity of the collected startup events, and thus improve the integrity and accuracy of statistical data. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] Figure 1 A schematic diagram of a flow chart of a method for collecting Android application startup events provided by the present invention. DETAILED DESCRIPTION
[0028] In order to make the technical problems, technical solutions and beneficial effects solved by the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.
[0029] The present invention provides a method for collecting Android application startup events, comprising the following steps:
[0030] Step 1, the initial state of the AppStart switch can be triggered to be turned on;
[0031] Step 2, performing real-time status detection on the application to determine whether it is in a foreground running state or a background running state; wherein the application is an Android application;
[0032] When it is detected that the application changes from the foreground running state to the background running state, execute step 3;
[0033] When it is detected that the application changes from the background running state to the foreground running state, execute step 4;
[0034] Specifically, monitor the number of Activities visible to the application; Activity refers to the interface through which the application interacts with the user;
[0035] When the number of Activities changes from 1 to 0, it is determined that the application changes from the foreground running state to the background running state;
[0036] When the number of Activities changes from 0 to 1, it is determined that the application has changed from the background running state to the foreground running state.
[0037] Step 3, start the AppEnd countdown;
[0038] During the AppEnd countdown of the set time length, for example, the AppEnd countdown time length is 30 seconds, if it is detected that the application changes from the background running state to the foreground running state, then return to step 2; if the application remains in the background running state throughout the AppEnd countdown, then when the AppEnd countdown ends, trigger the submission of the application end event AppEnd, set the triggerable AppStart switch to the on state, and then return to step 2;
[0039] Step 4, close the AppEnd countdown; determine the state of the triggerable AppStart switch, if it is in the off state, return to step 2; if it is in the on state, on the one hand, set the triggerable AppStart switch to the off state, return to step 2, on the other hand, trigger the submission of the application startup event AppStart, and then execute step 5;
[0040] Step 5, when triggering the submission of the application start event AppStart, first check whether the application end event AppEnd is successfully submitted after the last submission of the application start event AppStart. If it has been submitted, execute step 6; if not, submit the last application end event AppEnd additionally, and then execute step 6;
[0041] Step 6: Execute the process of submitting the application startup event AppStart. The specific method is as follows:
[0042] Step 6.1, observe the initialization state of oaid_sdk within the set time, for example, the set time is 5 seconds, the oaid_sdk initialization process is the process of obtaining the anonymous device identifier oaid, when oaid_sdk initialization is successful, the anonymous device identifier oaid is obtained;
[0043] Step 6.2, write the obtained anonymous device identifier oaid into the application start event AppStart, and submit the application start event AppStart;
[0044] Step 6.3, the application determines whether the device has enabled vid verification. If vid verification has been enabled, a timer with an interval t is set to periodically detect the device identifier vid until the device identifier vid is successfully detected, and then step 6.4 is executed;
[0045] If vid inspection is not enabled, determine whether the device identifier vid can be successfully detected. If so, execute step 6.4. If not, set a timer with an interval time t to periodically and continuously detect the device identifier vid. When the device identifier vid is successfully detected, execute step 6.4. When the detection times reach the set maximum times, if the device identifier vid is still not detected, on the one hand, send the application start event AppStart. On the other hand, retain the data of the application start event AppStart. When the device identifier vid is successfully detected, write the detected device identifier vid into the reserved data of the application start event AppStart, write a resend flag, and then send the reserved application start event AppStart.
[0046] Step 6.4, write the detected device identifier vid into the application start event AppStart, and then send the application start event AppStart.
[0047] The method for collecting Android application startup events provided by the present invention has the following advantages:
[0048] The present invention provides a method for collecting Android application startup events, which can effectively solve the problem of losing oaid in the collected startup events or losing vid due to delayed setting of vid, ensure the information integrity of the collected startup events, and thus improve the integrity and accuracy of statistical data.
[0049] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present invention. These improvements and modifications should also be considered as the scope of protection of the present invention.
Claims
1. A method for collecting Android application startup events, characterized in that: The following steps are involved: Step 1, the initial state of the AppStart switch can be triggered to be turned on; Step 2, performing real-time status detection on the application to determine whether it is in a foreground running state or a background running state; wherein the application is an Android application; When it is detected that the application changes from the foreground running state to the background running state, execute step 3; When it is detected that the application changes from the background running state to the foreground running state, execute step 4; Step 2 is as follows: Monitor the number of Activities visible to the application; Activity refers to the interface through which the application interacts with the user; When the number of Activities changes from 1 to 0, it is determined that the application changes from the foreground running state to the background running state; When the number of Activities changes from 0 to 1, it is determined that the application changes from the background running state to the foreground running state; Step 3, start the AppEnd countdown; During the AppEnd countdown of the set time, if it is detected that the application changes from the background running state to the foreground running state, return to step 2; if the application remains in the background running state during the entire AppEnd countdown, when the AppEnd countdown ends, trigger the submission of the application end event AppEnd, set the triggerable AppStart switch to the on state, and then return to step 2; Step 4, close the AppEnd countdown; determine the state of the triggerable AppStart switch, if it is in the off state, return to step 2; if it is in the on state, on the one hand, set the triggerable AppStart switch to the off state, return to step 2, on the other hand, trigger the submission of the application startup event AppStart, and then execute step 5; Step 5, when triggering the submission of the application start event AppStart, first check whether the application end event AppEnd is successfully submitted after the last submission of the application start event AppStart. If it has been submitted, execute step 6; if not, submit the last application end event AppEnd additionally, and then execute step 6; Step 6: Execute the process of submitting the application startup event AppStart, specifically: Step 6.1, observe the initialization state of the software development kit oaid_sdk of the anonymous device identifier within the set time. The initialization process of the software development kit oaid_sdk of the anonymous device identifier is the process of obtaining the anonymous device identifier oaid. When the software development kit oaid_sdk of the anonymous device identifier is initialized successfully, the anonymous device identifier oaid is obtained; Step 6.2, write the obtained anonymous device identifier oaid into the application start event AppStart, and submit the application start event AppStart; Step 6.3, the application determines whether the device has enabled the device identifier vid check. If the device identifier vid check is enabled, a timer with an interval time t is set to periodically check the device identifier vid until the device identifier vid is successfully detected, and then executes step 6.4; If the device identifier vid check is not enabled, determine whether the device identifier vid can be successfully detected. If so, execute step 6.
4. If not, set a timer with an interval time t to periodically and continuously detect the device identifier vid. When the device identifier vid is successfully detected, execute step 6.
4. When the detection times reach the set maximum times, if the device identifier vid is still not detected, on the one hand, send the application start event AppStart. On the other hand, retain the data of the application start event AppStart. When the device identifier vid is successfully detected, write the detected device identifier vid into the reserved data of the application start event AppStart, write a resend flag, and then send the reserved application start event AppStart. Step 6.4, write the detected device identifier vid into the application start event AppStart, and then send the application start event AppStart.
Citation Information
Patent Citations
Locking method and mobile terminal of application program
CN105022955A
Mobile-terminal-based application closing detection method and system
CN106775759A
Monitoring data uploading method, apparatus, device and system, and storage medium
CN108023788A
Method, device and system for generating machine ID for application
CN110795399A