how to restrict background data in android programmatically : I am trying to make an app, which stops individual apps from data usage . I checked everywhere... and got nothing...please help..

I have tried in [https://developer.android.com/training/basics/network-ops/data-saver.html][1] but it is showing data usage... but not how to restrict it.

    ConnectivityManager connMgr = (ConnectivityManager)
            getSystemService(Context.CONNECTIVITY_SERVICE);
    // Checks if the device is on a metered network
    if (connMgr.isActiveNetworkMetered()) {
      // Checks user’s Data Saver settings.
      switch (connMgr.getRestrictBackgroundStatus()) {
        case RESTRICT_BACKGROUND_STATUS_ENABLED:
        // Background data usage is blocked for this app. Wherever possible,
        // the app should also use less data in the foreground.
    
        case RESTRICT_BACKGROUND_STATUS_WHITELISTED:
        // The app is whitelisted. Wherever possible,
        // the app should use less data in the foreground and background.
    
        case RESTRICT_BACKGROUND_STATUS_DISABLED:
        // Data Saver is disabled. Since the device is connected to a
        // metered network, the app should use less data wherever possible.
      }
    } else {
      // The device is not on a metered network.
      // Use data as required to perform syncs, downloads, and updates.
    }

thanks in advance


 