tags:

views:

355

answers:

1

Hi,

I tried to call the method ConnectivityManager.setNetworkPreference(NetworkPreference.PREFER_WIFI); //example from Professional Android Application Development book

but the method argument from the example seems to be obsolete. Does anyone know where to find network preference enumerators?

Thanks

+1  A: 

I haven't tested, so I can't be sure, but it seems to me that the two currently supported values are:

ConnectivityManager.TYPE_MOBILE

ConnectivityManager.TYPE_WIFI

There's a defined value for:

ConnectivityManager.DEFAULT_NETWORK_PREFERENCE

That's set to 1, the same value as ConnectivityManager.TYPE_WIFI

Which would make sense. This could be tested with a call to getNetworkPreference() after you've changed the setting to see if it "sticks."

lilbyrdie