Changes

no edit summary
Line 1: Line 1: −
<pre style="background-color: #EEEEEE; color: Black; border-radius: 10px; padding: 10px;">
+
<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>
This trigger will fire when the wifi state changes.
     −
You can configure it to fire
+
''' Options '''
   −
when wifi is enabled or disabled, or when connected to/disconnected from a specific network.
+
''' Trigger States '''
   −
Please note that since Android 8.1 this functionality requires location permission and location services enabled in order to detect connect/ disconnect events.
+
* '''Wifi Enabled''': Trigger when wifi is turned on
</pre>
+
* '''Wifi Disabled''': Trigger when wifi is turned off
<br>
+
* '''Connected to Network''': Trigger when connected to a wifi network
'''Example Usage'''<br/>
+
* '''Disconnected from Network''': Trigger when disconnected from a wifi network
   −
<pre style="background-color: #AC2424; color: white; border-radius: 10px; padding: 10px;">
+
''' Network Selection (for Connected/Disconnected) '''
Triggers
      +
When selecting "Connected to Network" or "Disconnected from Network":
   −
</pre><br>
+
* '''Any Network''': Trigger on connection/disconnection from any wifi network
<pre style="background-color: #1665B0; color: white; border-radius: 10px; padding: 10px;">
+
* '''Specific Networks''': Select one or more specific wifi networks by SSID
Actions
+
* '''Add SSID''': Manually add an SSID that is not currently in range
    +
The network selection dialog shows:
 +
* Networks detected during wifi scanning
 +
* Previously configured wifi networks on your device
 +
* Manually added SSIDs
   −
</pre><br>
+
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: green; color: white; border-radius: 10px; padding: 10px;">
  −
Constraints
      +
''' Requirements '''
   −
</pre><br>
+
* '''Location Permission''': On Android 8.1 (Oreo MR1) and above, location permission is required for connect/disconnect detection
<pre style="background-color: teal; color: white; border-radius: 10px; padding: 10px;">
+
* '''Location Services''': Location services must be enabled on Android 8.1+ for connect/disconnect events
Local variables
+
* '''Helper App''': On Android 10+ some features may require the MacroDroid Connectivity Helper or Universal Helper app
    +
''' Examples '''
   −
</pre><br>
+
  <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]]