IPNReceiver: Add intents to connect and disconnect VPN (#84)
* IPNReceiver: Add intents to connect and disconnect VPN Added a new class IPNReceiver to listen to intents silently and connect and disconnect the VPN Also removed unneeded comment Fixes: https://github.com/tailscale/tailscale/issues/3547 Signed-off-by: Brett Jenkins <brett@brettjenkins.co.uk>pull/85/head
parent
7245e72dcf
commit
51a53e5472
@ -0,0 +1,20 @@
|
||||
package com.tailscale.ipn;
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
|
||||
public class IPNReceiver extends BroadcastReceiver {
|
||||
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
if (intent.getAction() == "com.tailscale.ipn.CONNECT_VPN") {
|
||||
connect();
|
||||
} else if (intent.getAction() == "com.tailscale.ipn.DISCONNECT_VPN") {
|
||||
disconnect();
|
||||
}
|
||||
}
|
||||
|
||||
private native void connect();
|
||||
private native void disconnect();
|
||||
}
|
Loading…
Reference in New Issue