| Line 1: |
Line 1: |
| − | This trigger will fire when the device detects you are performing a certain activity such as moving in a vehicle, riding a bicycle or running. You can set a confidence value to control how easily the trigger will fire. A low confidence value is more likely to trigger but could potentially result in false triggers. A higher value should avoid false triggers but could fail to trigger in some cases where it should. | + | <pre class="header-style"> |
| | + | This trigger fires when the device detects you are performing a particular physical activity with the specified confidence level. It uses Google Play Services to analyze sensor data and determine your current movement state. |
| | + | </pre> |
| | | | |
| − | The underlying functionality of the Activity Recognition trigger is provided by Google Play services. The reliability of the trigger may be improved by enabling bluetooth, Wi-Fi and location services as these are fed into the recognition algorithm.
| + | ''' Options ''' |
| | | | |
| − | = Input parameters =
| + | When configuring this trigger, select one of the following activities: |
| | | | |
| − | == Activity type ==
| + | * '''In Vehicle''' - Traveling in a car, bus, train, or other motorized transport |
| − | Determines the type of activity to recognize and fire the trigger.
| + | * '''On Bicycle''' - Riding a bicycle |
| | + | * '''Running''' - Running or jogging |
| | + | * '''Walking''' - Walking at a normal pace |
| | + | * '''Still''' - Stationary with minimal movement |
| | | | |
| − | === Value type ===
| + | ''' Confidence Level ''' |
| − | In Vehicle | On Bicycle | Running | Walking | Still
| |
| | | | |
| − | == Confidence value ==
| + | Set a confidence threshold between '''10%''' and '''100%'''. This represents how certain the device must be that you are performing the selected activity before the trigger fires. |
| − | Determines sensitivity of the activity recognition. A low value may result in more false triggers and a high value may prevent the trigger from firing in some situations.
| |
| | | | |
| − | === Value type === | + | * '''Lower values (30-50%)''' - Trigger fires more readily, but may produce false positives |
| − | number (percents)
| + | * '''Higher values (70-90%)''' - More accurate detection, but may occasionally miss legitimate activity changes |
| | + | |
| | + | ''' Comparison Mode ''' |
| | + | |
| | + | * '''Greater than or equal to (≥)''' - The trigger fires when confidence rises to or above your threshold. Use this to detect when an activity '''starts'''. |
| | + | * '''Less than (<)''' - The trigger fires when confidence drops below your threshold. Use this to detect when an activity '''ends'''. |
| | + | |
| | + | ''' Example 1: Auto-connect car Bluetooth and play music ''' |
| | + | |
| | + | When you get in your car, automatically enable Bluetooth and start playing music. |
| | + | |
| | + | <pre class="trigger-style">Triggers |
| | + | |
| | + | Activity Recognition - In Vehicle (≥ 50%)</pre> |
| | + | <pre class="action-style">Actions |
| | + | |
| | + | Set Bluetooth State (Enable Bluetooth) |
| | + | Wait (5 Seconds) |
| | + | Connect to Bluetooth Device (Car Stereo) |
| | + | Media Controls (Play)</pre> |
| | + | |
| | + | ''' Example 2: Disable Wi-Fi when leaving home on foot ''' |
| | + | |
| | + | When you start walking, disable Wi-Fi to save battery. |
| | + | |
| | + | <pre class="trigger-style">Triggers |
| | + | |
| | + | Activity Recognition - Walking (≥ 60%)</pre> |
| | + | <pre class="action-style">Actions |
| | + | |
| | + | Set Wi-Fi State (Disable Wi-Fi)</pre> |
| | + | <pre class="constraint-style">Constraints |
| | + | |
| | + | Wi-Fi Connected</pre> |
| | + | |
| | + | ''' Example 3: Log when you stop running ''' |
| | + | |
| | + | Detect when a run has ended by monitoring for confidence dropping below threshold. |
| | + | |
| | + | <pre class="trigger-style">Triggers |
| | + | |
| | + | Activity Recognition - Running (< 50%)</pre> |
| | + | <pre class="action-style">Actions |
| | + | |
| | + | Write To File - Append "{hour}:{minute}:{second} - Run ended" to exercise_log.txt</pre> |
| | + | |
| | + | ''' Example 4: Enable Do Not Disturb when stationary at work ''' |
| | + | |
| | + | Automatically silence your phone when you're sitting still at work. |
| | + | |
| | + | <pre class="trigger-style">Triggers |
| | + | |
| | + | Activity Recognition - Still (≥ 70%)</pre> |
| | + | <pre class="action-style">Actions |
| | + | |
| | + | Set Do Not Disturb Mode (Priority Only)</pre> |
| | + | <pre class="constraint-style">Constraints |
| | + | |
| | + | Location (At Work)</pre> |
| | + | |
| | + | ''' Tips for Reliability ''' |
| | + | |
| | + | * '''Enable location services''' - GPS and network location data feed into the recognition algorithm and improve accuracy |
| | + | * '''Enable Wi-Fi scanning''' - Even when not connected, Wi-Fi scanning helps identify location context |
| | + | * '''Enable Bluetooth''' - Bluetooth connections (e.g., car audio systems) can help confirm vehicle detection |
| | + | * '''Adjust the update rate''' - The polling interval can be configured in MacroDroid Settings → Activity Recognition Update Rate (default is 120 seconds). Lower values detect changes faster but use more battery. |
| | + | |
| | + | ''' Permissions ''' |
| | + | |
| | + | On Android 10 and above, this trigger requires the '''Activity Recognition''' permission. MacroDroid will prompt you to grant this permission when you add the trigger. |
| | + | |
| | + | ''' Notes ''' |
| | + | |
| | + | * The trigger will '''not''' fire repeatedly for the same activity. It only fires when the detected activity changes and crosses your confidence threshold. |
| | + | * When using '''greater than (≥)''' mode, the trigger fires when the selected activity becomes the most probable activity AND exceeds your confidence level. |
| | + | * When using '''less than (<)''' mode, the trigger fires when confidence for the selected activity drops below your threshold (useful for detecting when an activity has ended). |
| | + | * Detection accuracy depends on your device's sensors (accelerometer, gyroscope) and their quality. Some electric or very smooth vehicles may be harder to detect. |
| | + | * This trigger uses the [https://developers.google.com/location-context/activity-recognition Google Activity Recognition API] via Google Play Services. |
| | + | |
| | + | ''' Troubleshooting ''' |
| | + | |
| | + | * '''Trigger never fires''' - Lower the confidence threshold, ensure Google Play Services is installed and up to date |
| | + | * '''Too many false triggers''' - Increase the confidence threshold |
| | + | * '''Delayed detection''' - Reduce the Activity Recognition Update Rate in MacroDroid Settings |
| | + | * '''Vehicle not detected''' - Ensure location services are enabled; try lowering the confidence threshold |
| | + | |
| | + | ''' See Also ''' |
| | + | |
| | + | * [[Action:_MacroDroid_Settings|MacroDroid Settings Action]] - Can modify update rate |