09.03.2012 0:52, Johannes пишет:
I have a really weird issue with WifiManager: I connect to a network
using WifiManager.enableNetwork(int netId, boolean disableOthers),
with setting disableOthers to 'true'. This seems necessary in order to
reliably establish a connection.
Yes, that's how the old, pre-3.0, WiFi API works.
However, this sets all other saved
networks to 'disabled', meaning that I cannot connect to them until I
re-activate them in the wifi settings.
Yep. Although - some firmwares do connect to disabled networks, if those
are the only ones found by scanning.
I tried to enable the previously enabled networks like this:
wifiConfiguration.status = WifiConfiguration.Status.ENABLED;
wifiManager.updateNetwork(wifiConfiguration);
...
wifiManager.saveConfiguration();
However, after this, all networks' 'status' fields are still set to 1
(WifiConfiguration.Status.DISABLED).
Are you specifying the networkId?
When are you doing this?
I know this works if done once the connection (kicked off by
enableNetwork(n, true) and startScan()) fully completes or fails.
Trying to do this immediately after you've kicked off the connection
process might not work.
You should be able to clarify things by grabbing a copy of
packages/apps/Settings from the source repository.
Staying close to what the Settings app does will improve the chances of
your code working.
I also get a weird log message on
saveConfiguration():
03-08 16:14:26.125: W/BackupManagerService(110): dataChanged but no
participant pkg='com.android.providers.settings' uid=10060
I believe this means that the backup manager was notified of a network
configuration change, but you haven't configured your device to back up
and restore personal data and settings. In other words, ignore.
-- Kostya
Any ideas?
--
Kostya Vasilyev
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en