For apps targeting Android 10, where a method to change this was added, the
default changed so that all VPN connections are marked as metered. This means
certain background operations (e.g. syncing data) are not performed anymore
even when connected to a WiFi. By setting this to false, the metered state
of the VPN connection reflects that of the underlying networks.
PendingIntent pending = PendingIntent.getActivity(context, 0, intent,
PendingIntent.FLAG_UPDATE_CURRENT);
builder.setConfigureIntent(pending);
+
+ /* mark all VPN connections as unmetered (default changed for Android 10) */
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q)
+ {
+ builder.setMetered(false);
+ }
return builder;
}