VpnCilla Automation

"Connect/Disconnect VPN Session out of Tasker or other Apps

VpnCilla could be connected/disconnected by a specific "Android Intent Action" eg. using "Tasker", the shell command "am" or by any other Android App.

This could als occur in background when the display is off but consider, when connecting the first time after the device rebooted or switched from other VPN providers, Android presents for security reason a confimation dialog which the user has to confirm manually that he or she trusts VpnCilla as a VPN provider. Unfortunately this can't be suppressed on custom VPN providers as VpnCilla is.

To define a session with Tasker you could define the Tasker item(s) yourself with following parameters:

 

Set Tasker Action: System --> Send Intent

Target:  Activity

Action:  android.intent.action.MAIN

Package: com.gmail.mjm4456.vpncilla

Class: com.gmail.mjm4456.vpncilla.VpncList

Extra: android.intent.extra.shortcut.NAME:MyConnection (change MyConnection according your Connection Name)

Extra: vpncilla.extra.FORCE:connect or disconnect (optional, if this extra is missing, the connection state is toggled)

Flags: FLAG_ACTIVITY_NEW_TASK    (not available/needed in Tasker but when programming via Android API)

Otherwise if you also could simply import the xml files below but don't forget to adapt the Connection Name ("MyConnection") accroding to your connection name (Many thanks to Lorand)

If using the Android API program intent(s) with the corresponding information above.

Receiving the vpn connection state broadcasts

Always when the VpnCilla connection state is changed, it fires following broadcast intent:

Intent: "com.gmail.mjm4456.vpncilla.VPNC_CONNECTIVITY_CHANGE"

Integer Extra: "reason" 

    which is set to:

    0 = VPNC_STOPPED

    1 = VPNC_CONNECTED

    2 = VPNC_ERROR

    3 = VPNC_CONNECTING

    4 = VPNC_WAIT_ON_RECONNECT

Have fun

Matthias