问题描述
我想在我的 VpnService 上调用函数,但我无法决定什么是最好的方法。
目前我有连接、暂停和断开连接:
@Override
public int onStartCommand(Intent intent,int flags,int startId) {
if (intent != null) {
LAST_ACTION = intent.getAction();
}
if (intent != null && ACTION_DISCONNECT.equals(intent.getAction())) {
stopVpn();
return START_NOT_STICKY;
} else if (intent != null && ACTION_SUSPEND.equals(intent.getAction())) {
stopVpnWithoutTurningVpnSharedPref();
return START_NOT_STICKY;
} else {
return START_STICKY;
}
}
执行这些操作的这种方法看起来很完美,但我不确定是否可以使用这种方法来更新我想要的 VPN 规则。
对于更新或调用函数,我能做什么?
我不想使用:
- 静态方法
- 广播接收器/EventBus
我需要将新规则推送到我当前的 VPN,目前它是由
public static void pushNewRules(Rules roles) {
谢谢
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)