android: Suppress deprecation warning because of stopForeground()

This commit is contained in:
Tobias Brunner
2025-02-18 14:12:43 +01:00
parent 5237bf3a5c
commit b021406f6b
@@ -399,11 +399,24 @@ public class CharonVpnService extends VpnService implements Runnable, VpnStateSe
public void run()
{
mShowNotification = false;
stopForeground(true);
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N)
{
stopForegroundCompat();
}
else
{
stopForeground(STOP_FOREGROUND_REMOVE);
}
}
});
}
@SuppressWarnings("deprecation")
private void stopForegroundCompat()
{
stopForeground(true);
}
/**
* Create a notification channel for Android 8+
*/