Disable programmatically limit background data

I have an HTC one M8 running Android 5. I have settings → more → data usage → background data limitation (checked)

This will disable background data.

I would like to enable it (uncheck) programmatically using the following code in onCreate of one of my operations.

ContentResolver.setMasterSyncAutomatically(true);

. Unfortunately, he is not returning. The manifest has the following:

<uses-permission android:name="android.permission.WRITE_SYNC_SETTINGS" />
<uses-permission android:name="android.permission.READ_SYNC_SETTINGS" />

Any ideas why this is not working?

early

+4
source share

All Articles