Task Detection Method in Android Smart TV
By using AccessibilityService to monitor changes in Android smart TV forms, statistical reporting of video viewing time of different video APPs is achieved, and the problem of lack of universality of task detection methods in the existing technology is solved, and the universality and efficiency of detection methods are improved.
Patent Information
- Application Number
- CN202211342270.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-10-31
- Publication Date
- 2025-06-24
- Estimated Expiration
- 2042-10-31
AI Technical Summary
The existing Android smart TV task detection methods lack universality, resulting in TV manufacturers needing to connect in-depth functions with each video APP, which is cumbersome and time-consuming.
By using AccessibilityService to monitor changes in Android smart TV forms, get the application's package name and activity name, and match it with the task list. After the match is successful, match the text content of the current focus form and the video name of the task list, start time and count the time. If the time exceeds the set time, the task will be reported to be completed.
It realizes statistical reporting of the video viewing time of different video APPs, avoiding separate docking for each video APP, greatly improving the universality of task detection methods.
Smart Images

Figure CN115665449B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of task detection for Android smart TVs, and particularly to a task detection method for Android smart TVs. Background Art
[0002] There are already a large number of Android smart TVs in the market. How to enable TV manufacturers to generate additional value after the TVs are sold is a problem faced by all TV manufacturers. Currently, the most common way is to cooperate with video APPs (Applications) to increase revenue by increasing the exposure rate of the cooperative video APPs.
[0003] The existing task detection method is that TV manufacturers display a task list to prompt users to enter a specified video APP to watch a specified video, and rewards are given to users after the task is completed. However, information such as the duration of watching the specified video requires in-depth functional docking between the TV manufacturer and the specified video APP. The specified video APP notifies the completion of the task, and the TV manufacturer needs to perform in-depth functional docking for each cooperative video APP and then iterate the software version, which is very cumbersome, time-consuming and laborious. Therefore, there is a lack of a general and efficient task detection method. Summary of the Invention
[0004] The purpose of the present invention is to provide a task detection method for Android smart TVs, which greatly improves the generality of the detection method.
[0005] The present invention adopts the following technical solutions to achieve the above purpose. The task detection method for Android smart TVs includes a video viewing task detection method, and the video viewing task detection method includes:
[0006] Step 1: Use AccessibilityService to monitor the change of the Android smart TV form through the onAccessibilityEvent method, and trigger AccessibilityEvent.TYPE_WINDOWS_CHANGED;
[0007] Step 2: When the form change is triggered, the Android smart TV terminal obtains the package name and activity name of the application through activityManager.getRunningTasks and activitymanager.getRunningAppProgress, and performs a loop match with the task list of the terminal. If the match meets the conditions, go to Step 3;
[0008] Step 3: Use getRootInActiveWindow to obtain the window class AccessibilityNodeInfo note of the current focus.
[0009] Step 4: Traverse all notes of the node and use the Note.getText method to obtain the text content of the view. Match the obtained text content with the video name in the task list. If the match is successful, start timing.
[0010] Step 5: If it is monitored that the window changes are triggered again, end the current timing and calculate the duration. If the duration exceeds the set duration, report that the task is completed.
[0011] Furthermore, the task detection method in the Android smart TV also includes an APP usage task detection method, and the APP usage task detection method includes:
[0012] Step 1: Use AccessibilityService to monitor the window changes of the Android smart TV through the onAccessibilityEvent method, triggering AccessibilityEvent.TYPE_WINDOWS_CHANGED.
[0013] Step 2: When the window changes are triggered, the Android smart TV terminal traverses and obtains the usage information of all applications through the queryAndAggregateUsageState method of UsageStateManager, including mLaucherCount: the number of launches, mTotalTimeInFroeGround: the usage duration, and mEndTimeStmap: the last usage time. Obtain the APP usage times and usage duration from the traversed information and match them with the corresponding information in the task list. When the APP usage times and duration meet the set conditions, report that the task is completed.
[0014] Furthermore, in the APP usage task detection method, if the window changes are triggered again, start timing again; if the window does not change within the set time, execute Step 2 in the APP usage task detection method and start timing again.
[0015] Furthermore, before Step 1, it also includes:
[0016] Deploy the task system to the cloud and configure the task list in an interface manner. The tasks include the package name, activity name, video name, viewing duration, and usage duration information of the application.
[0017] The Android smart TV terminal accesses the task system in the cloud to obtain a task list.
[0018] The beneficial effects of the present invention are as follows:
[0019] The present invention uses the AccessibilityService of the Android smart TV. By monitoring the changes in the smart TV form through the onAccessibilityEvent method, if a form change is detected, the package name and activity name of the application are obtained and matched with the terminal task list. If the match is successful, the AccessibilityNodeInfo note is obtained by inheriting the accessibility service getRootInActiveWindow; the text content of the view is obtained through Note.getText(), and the obtained text content is fully matched with the video name in the task list. If the match is successful, the video viewing time is started and the duration is counted. Only by providing the package name and activity name of the new cooperative APP, the video viewing duration of different video APPs can be statistically reported, avoiding the separate docking of each video APP and greatly improving the generality of the task detection method. Description of the Drawings
[0020] Figure 1 It is a schematic diagram of the video viewing task detection process provided by the embodiment of the present invention.
[0021] Figure 2 It is a schematic diagram of the APP usage task detection process provided by the embodiment of the present invention. Detailed Embodiments
[0022] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are some, but not all, of the embodiments of the present invention. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.
[0023] The task detection method in the Android smart TV of the present invention includes a video viewing task detection method, and the video viewing task detection method is as Figure 1 shown and includes:
[0024] Step 1: Use the AccessibilityService to monitor the changes in the Android smart TV form through the onAccessibilityEvent method, triggering AccessibilityEvent.TYPE_WINDOWS_CHANGED;
[0025] Step 2: When the form change is triggered, the Android smart TV terminal obtains the package name and activity name of the application through activityManager.getRunningTasks and activitymanager.getRunningAppProgress, and loops through the task list of the terminal for matching. If the match is successful, proceed to Step 3;
[0026] Step 3: Obtain the form class AccessibilityNodeInfo note of the current focus by inheriting the AccessibilityService's getRootInActiveWindow;
[0027] Step 4: Traverse all notes of the node, and obtain the text content of the view through the Note.getText method. Match the obtained text content with the video name in the task list. If the match is successful, start timing;
[0028] Step 5: If it is monitored that the form change is triggered again, end the current timing and calculate the duration. If the duration exceeds the set duration, report that the task is completed.
[0029] The task detection method in the Android smart TV of the present invention further includes an APP usage task detection method, and the APP usage task detection method is as Figure 2 shown, including:
[0030] Step 1: Use the AccessibilityService to monitor the changes in the Android smart TV form through the onAccessibilityEvent method, triggering AccessibilityEvent.TYPE_WINDOWS_CHANGED;
[0031] Step 2: When the form change is triggered, the Android smart TV terminal traverses and obtains the usage information of all applications through the queryAndAggregateUsageState method of the UsageStateManager, including mLaucherCount: the number of launches, mTotalTimeInFroeGround: the usage duration, and mEndTimeStmap: the last usage time. The usage times and usage durations of the APPs are obtained from the traversed information and matched with the corresponding information in the task list. When the usage times and durations of the APPs meet the set conditions, the task completion is reported.
[0032] In the APP usage task detection method, if the form change is triggered again, the timing starts over; if the form does not change within the set time, step 2 in the APP usage task detection method is executed, and the timing starts over again.
[0033] Before step 1, it also includes:
[0034] Deploy the task system to the cloud, and configure the task list in an interface. The tasks include the application package name, activity name, video name, viewing duration, and usage duration information.
[0035] The Android smart TV terminal accesses the task system in the cloud to obtain the task list.
[0036] This invention is elaborated in detail by taking the update of three library files based on the Android 9 platform as an example.
[0037] S1. Deploy a video viewing task to the cloud to watch "You Are My Glory" on Tencent Video for 30 minutes. The configured package name is com.ktcp.video, the activity is com.ktcp.video.activity.TVPlayerActivity, and the duration is 1800s. The terminal obtains the cloud task and stores it.
[0038] S2. Open Tencent Video to watch "You Are My Glory", trigger the AccessibilityService, and obtain the package name of the top application and the activity package name com.ktcp.video and activity name com.ktcp.video.activity.TVPlayerActivity through activityManager.getRunningTasks and activitymanager.getRunningAppProgress, which match the cloud-deployed task.
[0039] S3. Through the accessibility service's getRootInActiveWindow method, traverse the text information findtext of the current window, and if the obtained text information "You Are My Glory" exactly matches the video name in the task, start timing.
[0040] S4. After the window changes, stop timing. If the elapsed time is greater than 1800s, report that the cloud task is completed, and the cloud will issue gold coins and experience rewards to the user account.
[0041] S5. After the cloud task is completed, notify the terminal. The terminal will pop up a window to prompt that watching "You Are My Glory" on Tencent Video is completed, and display the obtained gold coins and experience.
[0042] In summary, the present invention only needs to provide the package name and activity name of the new cooperation APP to achieve the statistical reporting of the video viewing duration of different video APPs, avoiding the separate docking of each video APP, and greatly improving the generality of the task detection method.
Claims
1. A task detection method in an Android smart TV, characterized in that, Including a video viewing task detection method, the video viewing task detection method includes: Step 1: Use AccessibilityService to monitor the form changes of the Android smart TV through the onAccessibilityEvent method, triggering AccessibilityEvent.TYPE_WINDOWS_CHANGED; Step 2: When the form change is triggered, the Android smart TV terminal obtains the package name and activity name of the application through activityManager.getRunningTasks and activitymanager.getRunningAppProgress, and performs a loop match with the task list of the terminal. If the match meets the conditions, proceed to Step 3; Step 3: Obtain the form class AccessibilityNodeInfonote of the current focus through getRootInActiveWindow; Step 4: Traverse all notes of the node, and obtain the text content of the view through the Note.getText method. Match the obtained text content with the video name in the task list. If the match is successful, start timing; Step 5: If it is monitored that the form change is triggered again, end the current timing, count the duration. If the duration exceeds the set duration, report that the task is completed.
2. The task detection method in the Android smart TV according to claim 1, wherein, The task detection method in the Android smart TV further includes an APP usage task detection method, and the APP usage task detection method includes: Step 1: Use AccessibilityService to monitor the form changes of the Android smart TV through the onAccessibilityEvent method, triggering AccessibilityEvent.TYPE_WINDOWS_CHANGED; Step 2: When the form change is triggered, the Android smart TV terminal traverses and obtains the usage information of all applications through the queryAndAggregateUsageState method of UsageStateManager, including mLaucherCount: the number of launches, mTotalTimeInFroeGround: the usage duration, and mEndTimeStmap: the last usage time. Obtain the APP usage times and usage duration from the traversed information, and match them with the corresponding information in the task list. When the APP usage times and duration meet the set conditions, report that the task is completed.
3. The task detection method in the Android smart TV according to claim 2, characterized in that, In the APP usage task detection method, if the form change is triggered again, start timing again; if the form does not change within the set time, execute Step 2 in the APP usage task detection method and start timing again.
4. The task detection method in the Android smart TV according to claim 1 or 2, characterized in that, Before Step 1, it also includes: Deploy the task system to the cloud, and configure the task list through the interface. The tasks include the package name of the application, the activity name, the video name, the viewing duration, and the usage duration information. The Android smart TV terminal accesses the task system in the cloud to obtain the task list.
Citation Information
Patent Citations
Method for operating multiple applications of intelligent television synchronously
CN104202649A
Intelligent television task system
CN107509087A