Tool Name: airdroid_business_get_device_application_usage_duration
Risk Level: 🟢 Low Risk
Execution Mode: ⚡ Synchronous
Category: Reports & Analytics
Quick Start (Copy & Use)
In one sentence: Query device app usage duration statistics for a specified date range
What you need: StartDate (start date) + EndDate (end date)
Success criteria: StatusCode == 200 and ErrorMessage is empty; DeviceUsageDurationList contains usage data
What to do next: Analyze app usage patterns, generate usage reports, identify usage anomalies
Minimal request example:
{
"StartDate": "2026-01-01",
"EndDate": "2026-01-28"
}
Minimal response example:
{
"DeviceUsageDurationList": [
{
"device_id": "abc123",
"device_name": "Device A",
"group_name": "Sales",
"group_id": 100,
"duration": 7200,
"device_data_status": "Normal, has data",
"pkg_info": [
{
"pkg_id": "com.tencent.mm",
"app_name": "WeChat",
"icon_url": "https://example.com/wechat.png",
"duration": 3600
}
]
}
],
"Pagination": {
"total": 50,
"page_size": 10,
"current_page": 1,
"last_page": 5
},
"StatusCode": 200,
"ErrorMessage": ""
}
Recipes (Common Recipes)
Recipe 1: Query All Devices Usage Duration for the Last Week
Scenario: Generate weekly usage report
{
"StartDate": "2026-01-27",
"EndDate": "2026-02-03",
"Page": 1,
"PageSize": 50
}
Recipe 2: Query Usage Duration by Group
Scenario: View app usage for a specific group's devices
{
"StartDate": "2026-01-01",
"EndDate": "2026-01-28",
"GroupIds": [100],
"Page": 1,
"PageSize": 20
}
Recipe 3: Search for Specific Device with Extra Fields
Scenario: Find usage details for a specific device
{
"StartDate": "2026-01-01",
"EndDate": "2026-01-28",
"Keyword": "Samsung",
"SelectedColumns": ["model", "imei", "os_version"],
"Page": 1,
"PageSize": 10
}
Recipe 4: Paginate Through All Records
Scenario: Paginate when there are many devices
Paging strategy:
- First request with Page=1, get Pagination.last_page
- When current_page < last_page, use Page + 1 to get the next page
1. Overview
1.1 Description
This tool queries device app usage duration statistics for a specified date range. It returns the total usage duration for each device and the Top 5 apps by usage time. Suitable for productivity analysis, device usage monitoring, app usage compliance checks, and similar scenarios.
1.2 When to Use
- Productivity analysis: Understand device usage time distribution
- App usage monitoring: See which apps consume the most time
- Compliance checks: Ensure devices are used for work-related apps
- Device utilization analysis: Identify low-usage devices
1.3 Execution Mode & Response
This is a synchronous operation that returns results immediately upon invocation.
- Return value: DeviceUsageDurationList (usage duration list) + Pagination (pagination info)
- Data scope: Returns Top 5 apps by usage time for each device
1.4 Prerequisites
| Condition | Description | How to Verify |
|---|---|---|
| Date range limit | Cannot query data older than 30 days | Use dates within the last 30 days |
| Date span limit | Date range cannot exceed 30 days | EndDate - StartDate ≤ 30 days |
| AMS permission | Device must have "Allow collection of application usage" permission enabled | Check device permission settings |
| Account permission | Must have usage report viewing permissions | - |
1.5 Prerequisite Tools
| Dependency Tool | Purpose | Necessity |
|---|---|---|
| Get a Group ID by Group Name | Get GroupId for filtering | If filtering by group is needed |
2. Inputs
2.1 Parameter List
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| StartDate | string | ✅ Yes | - | Query start date |
| EndDate | string | ✅ Yes | - | Query end date |
| SelectedColumns | string-array | No | - | Extra device info fields to return |
| DeviceIds | string-array | No | - | Device ID list for filtering |
| GroupIds | number-array | No | - | Group ID list for filtering |
| Keyword | string | No | - | Search keyword |
| PageSize | number | No | 10 | Records per page |
| Page | number | No | 1 | Current page number |
2.2 Parameter Details
`StartDate`
Query start date.
- Type: string
- Format: YYYY-MM-DD
- Constraints:
- Cannot be a future date
- Cannot query data older than 30 days
- Example:
"2026-01-01"
`EndDate`
Query end date.
- Type: string
- Format: YYYY-MM-DD
- Constraints:
- Cannot be earlier than StartDate
- Cannot be a future date
- Interval with StartDate cannot exceed 30 days
- Example:
"2026-01-28"
`SelectedColumns`
Extra device info fields to return.
- Type: string-array
- Default fields (always included):
- device_name, snid, group_name, group_id, tags
- duration (seconds), pkg_info (Top 5 apps), device_data_status
- Optional fields:
- model: Device model
- android_id: Android device ID
- imsi: Primary IMSI number
- imei: Primary IMEI number
- mac: WiFi MAC address
- hdmi: HDMI info
- eth_mac: Ethernet MAC address
- app_version_open: App version
- iccid1: SIM card ICCID
- phone_number1: Phone number
- os_version: OS version
- manu: Manufacturer
- ip: Public IP
- private_ip: Private IP
- Example:
["model", "imei", "mac"]
`GroupIds`
Group ID list for filtering specific group devices.
- Type: number-array
- How to obtain:
- Via the Get a Group ID by Group Name tool
- Via the Get All Devices tool — group_id field in results
- Combination logic: When used with DeviceIds, results are combined (OR/union)
- Example:
[100, 101]
`Keyword`
Search keyword for fuzzy matching device information.
- Type: string
- Searchable fields: device_id, device_name, group_name, note, snid, imei, imsi, mac, eth_mac, manu, model, android_id, tags, os_version, app_version
- Example:
"Samsung"
2.3 Parameter Combination Logic
- StartDate and EndDate must both be provided, with interval not exceeding 30 days
- GroupIds and Keyword can be used independently or combined
- SelectedColumns only affects returned fields, not filtering logic
3. Outputs
3.1 Response Examples
Success response:
{
"DeviceUsageDurationList": [
{
"device_id": "abc123",
"device_name": "Device A",
"group_name": "Sales",
"group_id": "100",
"snid": "SN123456",
"tags": [{"tag_id": 1, "name": "VIP"}],
"duration": 7200,
"device_data_status": "Normal, has data",
"pkg_info": [
{
"pkg_id": "com.tencent.mm",
"app_name": "WeChat",
"icon_url": "https://example.com/wechat.png",
"duration": 3600
},
{
"pkg_id": "com.whatsapp",
"app_name": "WhatsApp",
"icon_url": "https://example.com/whatsapp.png",
"duration": 1800
}
]
}
],
"Pagination": {
"total": 50,
"page_size": 10,
"current_page": 1,
"last_page": 5
},
"StatusCode": 200,
"ErrorMessage": ""
}
Error response:
{
"DeviceUsageDurationList": [],
"Pagination": {},
"StatusCode": -1,
"ErrorMessage": "Invalid start_date. Must be a non-empty string."
}
3.2 Field Descriptions
| Field Path | Type | Description |
|---|---|---|
| StatusCode | number | Status code. See 5.1 AB Three-Layer Error Codes |
| ErrorMessage | string | Error message. Empty string on success |
| DeviceUsageDurationList | array | Device usage duration list |
| DeviceUsageDurationList[].device_id | string | Device unique identifier |
| DeviceUsageDurationList[].device_name | string | Device display name |
| DeviceUsageDurationList[].group_name | string | Device group name |
| DeviceUsageDurationList[].group_id | string | Device group ID |
| DeviceUsageDurationList[].snid | string | Device serial number |
| DeviceUsageDurationList[].tags | array | Device tags |
| DeviceUsageDurationList[].duration | number | Total usage duration (seconds) |
| DeviceUsageDurationList[].device_data_status | string | Device data status (important) |
| DeviceUsageDurationList[].pkg_info | array | Top 5 apps by usage time |
| DeviceUsageDurationList[].pkg_info[].pkg_id | string | App package identifier |
| DeviceUsageDurationList[].pkg_info[].app_name | string | App display name |
| DeviceUsageDurationList[].pkg_info[].icon_url | string | App icon URL |
| DeviceUsageDurationList[].pkg_info[].duration | number | App usage duration (seconds) |
| Pagination | object | Pagination info object |
3.3 device_data_status Values (Important)
| device_data_status Value | Meaning |
|---|---|
| Normal, has data | Data collected normally |
| Android system version too low (requires Android 5.0+) | Needs Android 5.0+ to collect screen time |
| Daemon version too low | Daemon version must be >= 10307000 |
| AMS permission not enabled | Device has not enabled "Allow collection of application usage" permission |
| Device offline or no screen time data transmitted in this period | Device offline or no data reported during this period |
Important: When device_data_status is not "Normal, has data", duration may be 0 or inaccurate, and pkg_info may be empty. Verify data validity based on the status.
3.4 Duration Unit
Conversion:
- Minutes = duration / 60
- Hours = duration / 3600
4. Examples
4.1 Basic Example: Query All Devices Usage for One Week
Request parameters:
{
"StartDate": "2026-01-20",
"EndDate": "2026-01-27",
"Page": 1,
"PageSize": 20
}
4.2 Advanced Example: Query by Group with Device Model
Request parameters:
{
"StartDate": "2026-01-01",
"EndDate": "2026-01-28",
"GroupIds": [100],
"SelectedColumns": ["model", "os_version"],
"Page": 1,
"PageSize": 10
}
4.3 Error Example: Date Range Exceeds 30 Days
Request parameters:
{
"StartDate": "2025-12-01",
"EndDate": "2026-01-31"
}
Note: Date range is limited to 30 days. Exceeding may return an error or be automatically truncated. Consider querying in segments.
5. Error Handling
5.1 AB Three-Layer Error Codes
| StatusCode | Meaning | Usage Scenario | Agent Response |
|---|---|---|---|
| -1 | Parameter validation error | Local validation failed (missing required params, format errors) | ❌ Do not retry; fix parameters and call again |
| 200 | Business success or business error | HTTP request succeeded; check ErrorMessage | Empty ErrorMessage = success; non-empty = business error |
| 500 | Network/request exception | Timeout, connection failure, DNS resolution failure | ⚠️ May retry (up to 2 times, 5-second intervals) |
5.2 Common Errors
| StatusCode | ErrorMessage Example | Cause | Fix Suggestion |
|---|---|---|---|
| -1 | Invalid start_date. Must be a non-empty string. | Start date is empty | Provide a valid StartDate |
| -1 | Invalid end_date. Must be a non-empty string. | End date is empty | Provide a valid EndDate |
| -1 | access_token is invalid. | Auth token is invalid | Check credential configuration |
| 500 | Request timeout after 60 seconds. | Request timeout | Retry later |
5.3 Agent Self-Healing Decision Table
| StatusCode | Auto Retry | Retry Strategy | Manual Intervention |
|---|---|---|---|
| -1 | ❌ | - | Fix parameters and call again |
| 200 (non-empty ErrorMessage) | ❌ | - | Fix based on error message |
| 500 | ⚠️ | Up to 2 retries, 5-second intervals | Escalate if persistent failure |
6. Best Practices
6.1 Performance Optimization
- Use filter conditions: Use GroupIds or Keyword to narrow the query scope
- Increase PageSize: Set a larger PageSize as needed to reduce request count
- Control date range: Smaller query ranges yield faster responses
6.2 Security Notes
🟢 Read operation: This tool only queries usage data and has no special security requirements.
Privacy note: App usage duration may involve employee privacy; ensure appropriate usage policies and access controls are in place.
6.3 Data Validity Checks
When processing returned data, always check device_data_status:
if device_data_status == "Normal, has data":
# Data is valid; duration and pkg_info can be used
elif device_data_status contains "Android system version too low":
# Android version too low; cannot collect data
elif device_data_status contains "Daemon version too low":
# Daemon version too low; needs update
elif device_data_status contains "AMS permission not enabled":
# AMS permission not enabled; needs authorization on device
elif device_data_status contains "Device offline":
# Device offline or no data transmitted
7. Related Tools
7.1 Prerequisite Tools
| Tool Name | Purpose |
|---|---|
| Get a Group ID by Group Name | Get GroupId for filtering |
7.2 Follow-up Tools
| Tool Name | Purpose |
|---|---|
| Get All Devices | Get detailed device information |
| Get Device Application Report | View app installation statistics |
7.3 Similar Tools Comparison
| Tool Name | Use Case | Difference |
|---|---|---|
| Get Device Application Report | App installation statistics | Aggregates app installation info across all devices |
| Get Device Application Usage Duration | App usage analysis | Statistics on app usage duration per device, returns Top 5 apps |
8. Tool Chains
8.1 Productivity Analysis Pattern
Scenario: Analyze employee device usage
Tool chain:
Get Device Application Usage Duration → Data analysis/visualization
Steps:
- Set date range and call the tool to get usage data
- Filter valid data where device_data_status == "Normal, has data"
- Aggregate duration to generate usage duration rankings
- Analyze app usage distribution in pkg_info
8.2 Group Usage Comparison Pattern
Scenario: Compare device usage across different departments
Tool chain:
Get a Group ID by Group Name (multiple groups) → Get Device Application Usage Duration (query by group) → Comparative analysis
Steps:
- Use Get a Group ID by Group Name to get GroupIds for each department
- Call the tool separately, filtering by GroupIds
- Calculate average usage duration per group
- Compare and analyze usage differences across departments
8.3 Usage Anomaly Detection Pattern
Scenario: Identify devices with abnormal usage durations
Tool chain:
Get Device Application Usage Duration → Anomaly detection → Get All Devices → Notification
Steps:
- Get usage durations for all devices
- Calculate mean and standard deviation to identify anomalies (too high or too low)
- Use Get All Devices to get detailed info for anomalous devices
- Notify responsible personnel for investigation
Leave a Reply.