android: Suppress deprecation warning because of stopForeground()
This commit is contained in:
+14
-1
@@ -399,11 +399,24 @@ public class CharonVpnService extends VpnService implements Runnable, VpnStateSe
|
|||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
mShowNotification = false;
|
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+
|
* Create a notification channel for Android 8+
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user