In versions 4.0 and greater, if you app has background data turned off (by
the user) AND you are in the background and ask for the current active
network and check if it's connected, you will find it's not connected
(it'll be BLOCKED). In fact, if you try to access the network you will
If either your background data setting is off OR you are in the foreground
you will be told you are connected (provided a connection, of course).
Before 4.0 there wasn't strict data enforcement - the data background stuff
was a suggestion that was not enforced. Also the network status reported
was not app-specific.
I think that doing the calls you suggested should provide the correct
answer both pre-V4 and post-V4. Not doing the calls just means you may
fail after spending alot of time and energy setting up network comms.
If you want to put up a different notice if they are explicitly blocked by
a user policy, you can watch for NetworkInfo.DetailedState.BLOCKED.
Let me know if you still think this is a problem. We want to make APIs
that work for everybody.
On Mon, Jul 23, 2012 at 5:24 PM, Nathan <nathan.d.mel...
> On Monday, July 23, 2012 2:44:51 PM UTC-7, Kostya Vasilyev wrote:
>> It's also a good way to check if the user disabled network connectivity
>> (i.e. the "mobile data" toggle), and starting with Android 4.0, this is
>> also affected by the "allow apps to perform background sync" system setting.
>> -- K
> It was all good news and I was set to use it until now. But now I could be
> creating a support nightmare on 4.0.
> That *would* make sense, if "background sync" were the only possible thing
> that an app would use the internet for.
> It *would* make sense if a user sees "no internet connection " in an app,
> and immediately thinks, "oh, that must be because I disabled background
> synching". Not likely. More likely, they'll forget they ever used that
> setting and we will exchange ten emails.
> Maybe I misunderstand what "allow apps to perform background sync" is for.
> But I guarantee users will too.
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to email@example.com
> To unsubscribe from this group, send email to
> For more options, visit this group at