| Line 1: |
Line 1: |
| − | <span style="color: #B22A2A; font-size: 24px; display: inline-block; margin-top: 15px; margin-bottom: 0px;"><strong>About this trigger</strong></span> | + | <pre class="header-style">This trigger will fire when the wifi state changes. You can configure it to fire when wifi is enabled or disabled, or when connected to/disconnected from a specific network.</pre> |
| | | | |
| − | <pre style="background-color: #ACC8E5; color: #112A46; border-radius: 10px; padding: 10px; margin-top: 5px; margin-bottom: 5px;">
| + | ''' Options ''' |
| − | This trigger will fire when the wifi state changes.
| |
| | | | |
| − | </pre>
| + | ''' Trigger States ''' |
| | | | |
| − | <pre style="background-color: #FFFF99; color: #112A46; border-radius: 10px; padding: 10px; margin-top: 5px; margin-bottom: 5px;">
| + | * '''Wifi Enabled''': Trigger when wifi is turned on |
| − | Please note that since Android 8.1 this functionality requires location permission and location services enabled in order to detect connect/ disconnect events.
| + | * '''Wifi Disabled''': Trigger when wifi is turned off |
| − | </pre>
| + | * '''Connected to Network''': Trigger when connected to a wifi network |
| | + | * '''Disconnected from Network''': Trigger when disconnected from a wifi network |
| | | | |
| − | <span style="color: #B22A2A; font-size: 18px; display: inline-block; margin-top: 15px; margin-bottom: 15px;"><strong>Available Features</strong></span>
| + | ''' Network Selection (for Connected/Disconnected) ''' |
| | | | |
| − | * '''Connected to network '''
| + | When selecting "Connected to Network" or "Disconnected from Network": |
| | | | |
| − | <pre style="background-color: #ACC8E5; color: #112A46; border-radius: 10px; padding: 10px; margin-top: 5px; margin-bottom: 5px;">
| + | * '''Any Network''': Trigger on connection/disconnection from any wifi network |
| − | * Any Network | + | * '''Specific Networks''': Select one or more specific wifi networks by SSID |
| − | * Select manually | + | * '''Add SSID''': Manually add an SSID that is not currently in range |
| − | * Add SSID | |
| − | </pre>
| |
| | | | |
| − | * '''Disconnected from network''' | + | The network selection dialog shows: |
| | + | * Networks detected during wifi scanning |
| | + | * Previously configured wifi networks on your device |
| | + | * Manually added SSIDs |
| | | | |
| − | <pre style="background-color: #ACC8E5; color: #112A46; border-radius: 10px; padding: 10px; margin-top: 5px; margin-bottom: 5px;"> | + | Multiple networks can be selected, and the trigger will fire when connecting to or disconnecting from any of the selected networks. |
| − | * Any Network
| + | |
| − | * Select manually
| + | ''' Requirements ''' |
| − | * Add SSID
| + | |
| − | </pre><br/> | + | * '''Location Permission''': On Android 8.1 (Oreo MR1) and above, location permission is required for connect/disconnect detection |
| − | * '''Wifi disabled'''
| + | * '''Location Services''': Location services must be enabled on Android 8.1+ for connect/disconnect events |
| − | <br/>
| + | * '''Helper App''': On Android 10+ some features may require the MacroDroid Connectivity Helper or Universal Helper app |
| − | * '''Wifi enabled''' | + | |
| | + | ''' Examples ''' |
| | + | |
| | + | <pre class="trigger-style">Triggers |
| | + | |
| | + | Wifi State Change (Connected to Network: Home_Wifi)</pre> |
| | + | <pre class="action-style">Actions |
| | + | |
| | + | AutoSync On |
| | + | Set Variable: [location] = Home</pre> |
| | + | |
| | + | ''Configure device settings when connecting to home wifi.'' |
| | + | |
| | + | ---- |
| | + | |
| | + | <pre class="trigger-style">Triggers |
| | + | |
| | + | Wifi State Change (Wifi Disabled)</pre> |
| | + | <pre class="action-style">Actions |
| | + | |
| | + | Enable Mobile Data |
| | + | Notification: Wifi disabled, mobile data enabled</pre> |
| | + | |
| | + | ''Automatically enable mobile data when wifi is turned off.'' |
| | + | |
| | + | ---- |
| | + | |
| | + | <pre class="trigger-style">Triggers |
| | + | |
| | + | Wifi State Change (Disconnected from Network: Any Network)</pre> |
| | + | <pre class="action-style">Actions |
| | + | |
| | + | Wait 30 seconds |
| | + | If Wifi Connected = false |
| | + | Set Wifi: Off |
| | + | Set Wifi: On |
| | + | End If</pre> |
| | + | |
| | + | ''Auto-reconnect wifi after disconnection.'' |
| | + | |
| | + | ''' Notes ''' |
| | + | |
| | + | * Since Android 8.1, location permission and enabled location services are required to detect connect/disconnect events. |
| | + | * The trigger listens for NETWORK_STATE_CHANGED_ACTION, WIFI_STATE_CHANGED_ACTION, and SUPPLICANT_CONNECTION_CHANGE_ACTION system broadcasts. |
| | + | * For "Connected to Network" and "Disconnected from Network" options, wifi must be enabled to configure the trigger (you will be prompted to enable it if disabled). |
| | + | * Multiple SSIDs can be selected for connect/disconnect triggers. |
| | + | * Use "Any Network" if you want to trigger on all wifi connection/disconnection events regardless of the network name. |
| | + | |
| | + | ''' See Also ''' |
| | + | |
| | + | * [[Trigger:_Wifi_SSID_Transition|Wifi SSID Transition Trigger]] |
| | + | * [[Constraint:_Wifi_State|Wifi State Constraint]] |
| | + | * [[Action:_Wifi_Configure|Wifi Configure Action]] |