Not able to disable the mobile data

The below is my script. Here I run script with mobile data on. but when run this script I expect to disable the mobile data and wifi has to be enable. Here wifi is getting enable but mobile data is not getting off. Am I missing anything ?

    NetworkConnectionSetting h=new NetworkConnectionSetting(false, false, true);
    h.setData(false);
    h.setWifi(true);
    ((AndroidDriver)driver).setNetworkConnection(h);

For me always data is coming true: Even after executing the below statement.

NetworkConnectionSetting h=new NetworkConnectionSetting(false, false, false);
((AndroidDriver)driver).setNetworkConnection(h);

try using this, I have faced same issue with setData() and setWifi() methods.

public void SetNetworkConnection(boolean setAirplaneMode, boolean setWifi, boolean setData) {

		NetworkConnectionSetting networkConnection = new NetworkConnectionSetting(setAirplaneMode, setWifi, setData);
		driver.setNetworkConnection(networkConnection);
	}

The same code worked well except Moto G 2gen, in my caseā€¦Check the same script on Samsung S3 Neo Jelly Bean,Moto G2 Lollipop and Nexus 5 Marshmellow.

It is not working on MI4i (Android version 5.0.1). But I tested on MOTO G (Android 4.4.2) it worked for me. Can anybody suggest me Is this a bug in appium client ?

can somebody fix this problem on next version of appium ? Getting the same issue on many devices. Still not able to figure out the solution.