How do I enable Settings->Accounts and Sync->Background data programatically in ice cream sandwich ?
You cannot enable it programmatically. That is only for the user to do. If you could turn it off and on programmatically, why would it be a UI option at all!?
You cannot do it programatically. Only user has that privillege. How ever you can check whether he has enabled or not using .
ConnectivityManager mgr = (ConnectivityManager)Context.getSystemService(Context.CONNECTIVITY_SERVICE);
boolean bgData = mgr.getBackgroundDataSetting();
And request the user to set by opening the settings. Use ACTION_SYNC_SETTINGS for your intent. You have to make sure before sending it that the intent will resolve though, as some devices may not be able to interpret that intent. If they can't, send ACTION_SETTINGS instead, possibly with a note to the user telling them where the sync settings are (if your users aren't expected to be very tech savvy).