Changes

no edit summary
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.
     −
Please note that since Android 8.1 this functionality requires location permission and location services enabled in order to detect connect/ disconnect events.
+
''' Trigger States '''
</pre>
     −
==<p><b>Available Features </b></p>==
+
* '''Wifi Enabled''': Trigger when wifi is turned on
 +
* '''Wifi Disabled''': Trigger when wifi is turned off
 +
* '''Connected to Network''': Trigger when connected to a wifi network
 +
* '''Disconnected from Network''': Trigger when disconnected from a wifi network
   −
=== Connected to network ===
+
''' Network Selection (for Connected/Disconnected) '''
* ''''' Any Network '''''
  −
<pre style="background-color: #ACC8E5; color: #112A46; border-radius: 10px; padding: 10px;">
  −
It will react to any connected Wi-Fi (SSID).
  −
</pre>
     −
* ''''' Select manually '''''
+
When selecting "Connected to Network" or "Disconnected from Network":
<pre style="background-color: #ACC8E5; color: #112A46; border-radius: 10px; padding: 10px;">
  −
Manually select one or more Wi-Fi networks (SSID) that the trigger will react to.
  −
</pre>
     −
=== Disconnected from network ===
+
* '''Any Network''': Trigger on connection/disconnection from any wifi network
* ''''' Any Network '''''
+
* '''Specific Networks''': Select one or more specific wifi networks by SSID
<pre style="background-color: #ACC8E5; color: #112A46; border-radius: 10px; padding: 10px;">
+
* '''Add SSID''': Manually add an SSID that is not currently in range
It will react to any disconnected Wi-Fi (SSID).
  −
</pre>
     −
* ''''' Select manually '''''
+
The network selection dialog shows:
<pre style="background-color: #ACC8E5; color: #112A46; border-radius: 10px; padding: 10px;">
+
* Networks detected during wifi scanning
Manually select one or more Wi-Fi networks (SSIDs) that the activator will react to when disconnected.
+
* Previously configured wifi networks on your device
</pre>
+
* Manually added SSIDs
   −
=== Wifi disabled ===
+
Multiple networks can be selected, and the trigger will fire when connecting to or disconnecting from any of the selected networks.
<pre style="background-color: #ACC8E5; color: #112A46; border-radius: 10px; padding: 10px;">
  −
It is activated when Wi-Fi is deactivated.
  −
</pre>
     −
=== Wifi enabled ===
+
''' Requirements '''
<pre style="background-color: #ACC8E5; color: #112A46; border-radius: 10px; padding: 10px;">
+
 
It is activated when WiFi is activated.
+
* '''Location Permission''': On Android 8.1 (Oreo MR1) and above, location permission is required for connect/disconnect detection
</pre>
+
* '''Location Services''': Location services must be enabled on Android 8.1+ for connect/disconnect events
 +
* '''Helper App''': On Android 10+ some features may require the MacroDroid Connectivity Helper or Universal Helper app
 +
 
 +
''' 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]]