Hello, I think I may have resolved the addNetwork failure issue.
The other questions (examples 1-4) are still outstanding. Thanks. Alex Donnini On Apr 2, 8:49 am, alexdonnini <[email protected]> wrote: > I posted the following on the platform group too. > > Hello, > > I am building an application which provides some WIFI management > functions and, eventually, delivers p2p functionality. > > I have been testing the API provided via the SDK. One problem I have > run into is that execution of the addNetwork(WifiConfiguration) > function always returns -1, i.s. the operation fails. return code "-1" > is the generic failure code (not informative other than the fact that > it reports a failure). > > Here is a code snippet: > > WifiConfiguration newWifiConfiguration = new > WifiConfiguration(); > > newWifiConfiguration.SSID = > wifiNetworkList.get(j).SSID; > newWifiConfiguration.networkId = > wifiNetConfigurations.size > (); > newWifiConfiguration.status = 2; > newWifiConfiguration.hiddenSSID = true; > newWifiConfiguration.allowedKeyManagement.set > (KeyMgmt.NONE); > > > wifiNetConfigurations.add(newWifiConfiguration); > > addedWifiNetworkId = > wifi.addNetwork(newWifiConfiguration); > > Please note that the failure of the addNetwok operation occurs > regardless of the specific list of attributes assigned to the new > configuration. The configuration add operation works. > > Could someone explain to me why this failure occurs, and what I am > doing worng? > > I have also begun experimenting with the use of WifiService, > WifiStateTracker, and WifiMonitor. WifiService operations trying to > enable WIFI run into permission issues. In many instances, information > reported by methods in these classes appears to be contradictory with > the actual state of the phone. Here are some examples: > > Example 1 > ========== > When I instantiate WifiService (mWifiService = new WifiService > (CommManager.this, mWifiStateTracker)), it reports, correctly that > WIFI is enabled, > > Log.d(TAG, "WifiService starting up with Wi-Fi " + > (wifiEnabled ? "enabled" : "disabled")); > > However, subsequently, when I try to scan for WIFI networks > (mWifiService.startScan()), the operation fails (i.e. returns false). > > Example 2 > ========== > When WIFI is disabled, and WifiService tries to enable/start WIFI in > response to MESSAGE_ENABLE_WIFI and MESSAGE_START_WIFI, or at > construction time, using setWifiEnabledBlocking, it is prevented from > doing so reporting > Log.e(TAG, "Failed to load Wi-Fi driver.") > > Example 3 > =========== > WifiStateTracker function as isAvailble() returns false, even though > WIFI is enabled (as confirmed via the UI). > > Example 4 > =========== > WifiMonitor is prevented from connecting to the supplicant reporting: > > 04-02 08:37:29.018: INFO/System.out(1503): WifiMonitor - > ensureSupplicantConnection - connecting to supplicant via WifiNative > --- > 04-02 08:37:29.018: DEBUG/WifiHW(1503): Unable to open connection to > supplicant on "tiwlan0": Permission denied > 04-02 08:37:29.018: INFO/System.out(1503): WifiMonitor - > ensureSupplicantConnection - failed to connect to supplicant via > WifiNative --- > > The above failure occurs with WIFI enabled or disabled. > > I would appreciate feedback, and information as to the reason for the > above failures, in order to correct errors I have made in using WIFI > related classes. > > Thanks. > > Alex Donnini > > On Apr 1, 10:15 pm, Dianne Hackborn <[email protected]> wrote: > > > Thanks. I just mean to say that if you are wanting information, it is very > > helpful to be explicit about the information you are looking for rather than > > just asking general questions that would require a very long reply to > > address. > > > Very often I see questions asked that you just can't answer without spending > > 2 hours on the answer if you don't go back and probe further about what > > exactly the poster is looking for. More often than not I don't answer these > > because I don't have the time to put into that. So asking a question in a > > way that someone can give a much more specific and less time consuming > > answer will tend to increase the chances of getting an answer at all. > > > The issue of permissions is a good example: clearly, yes there are > > permissions, and hopefully it is clear that it is desirable for them to be > > there since the vast majority of applications shouldn't be doing these > > things and they can have a serious impact on the overall system. So to > > provide an answer, it helps a lot to know what someone is actually wanting > > to do that makes them think they need access to those permissions. Maybe > > this means there should be some new API or mechanism for their feature. > > Maybe there is a totally different way to go about it. How does someone > > provide a good answer without knowing what the original poster is actually > > trying to accomplish? > > > Also note that this is the first time you have actually said anything about > > loading and unloading wifi drivers. That is a very useful piece of > > information right there. :) (Though again it begs the question... why does > > one want to do -that-?) > > > On Wed, Apr 1, 2009 at 6:43 PM,alexdonnini<[email protected]> wrote: > > > > Thanks for the detailed feedback. I appreciate it, and will follow > > > your advice. > > > > I do have a question. If at this point, I am only gathering > > > information (i.e. my original question about the purpose of > > > WifiService, and the issue of permissions to perform functions such as > > > loading and unloading a WIFI driver), I seem to understand that in > > > your opinion such a request for information will not get much of a > > > response unless I describe in some detail what I would like to do (am > > > doing). Is this correct? > > > > If this is the way it is, I will conform although I don't quite > > > understand why. > > > > Again, thanks for your response > > > > On Apr 1, 7:06 pm, Dianne Hackborn <[email protected]> wrote: > > > > I am not trying hide things. You asked a really broad question (tell me > > > all > > > > about this stuff) which I doubt anyone will answer because they would > > > spend > > > > a lot of time writing things not knowing what would be useful and what > > > not. > > > > > For what it's worth, I don't work on wifi stuff, so I can't help you > > > > with > > > > details. I am just trying to get this going in a direction that can > > > > actually help anyone. > > > > > You might want to try posting to android-platform; there might be > > > engineers > > > > who work on wifi there. Also I would strongly recommend going at this > > > from > > > > the perspective of "I'd like to make extension X and modification Y" to > > > the > > > > API rather than "the stuff is limited" (in what way?) and "doesn't > > > > always > > > > work" (what isn't working?) and "I have partially implemented some of > > > > the > > > > stuff I want" (what have you implemented?). > > > > > On Wed, Apr 1, 2009 at 2:21 PM,alexdonnini<[email protected]> > > > wrote: > > > > > > I am trying to expand and improve on WIFI management functions which > > > > > currently are limited, and don't always work. > > > > > > At this point, I am looking for information about specific functions > > > > > performed by WifiSerivce and, to a lesser extent, WifiMonitor and > > > > > WifiStateTracker. I would think someone knows the answer to these > > > > > questions and that related to permissions. I did not think this was a > > > > > big deal. > > > > > > By the way, I have read carefully (to the best of my ability), several > > > > > times, the documentation on all the WIFI related APIs and classes in > > > > > the SDK. They do not allow the fine grained control that WifiService, > > > > > WifiStateTracker, and WifiMonitor allow. I have also experimented > > > > > using WifiLayer. It is OK. It provides an API for some of the > > > > > functions I am interested in implementing (and already have partially > > > > > implemented). Initial testing of AccessPointState has been going OK > > > > > too. > > > > > > Again, I would not think that the information I am looking for is, or > > > > > should be a big secret. > > > > > > Thanks. > > > > > > Alex Donnini > > > > > > On Apr 1, 4:27 pm, Dianne Hackborn <[email protected]> wrote: > > > > > > What are you trying to do? > > > > > > > On Wed, Apr 1, 2009 at 1:00 PM,alexdonnini<[email protected]> > > > > > wrote: > > > > > > > > Hello, > > > > > > > > Could anyone explain to me the intended purpose of > > > WifiService.java? > > > > > > > > I am trying to understand if and how it could be used for an > > > > > > > application. > > > > > > > > I am also exploring the use of: > > > > > > > - WifiMonitor > > > > > > > - WifiStateTracker > > > > > > > With regard to both of the above, I can understand the potential > > > use a > > > > > > > little better. > > > > > > > > For all three, I can see that one potential issue is permissions. > > > > > > > > Based on some initial testing, it does not look like the standard > > > > > > > Android permissions (as included in the manifest file) are > > > sufficient. > > > > > > > Am I wrong? > > > > > > > > If I am correct about the permissions issue, I would like to > > > > > > > understand if and how an pplication could obtain the permission to > > > > > > > perform some of the tasks executed by WifiMontior, > > > WifiStateTracker, > > > > > > > and WifiService. > > > > > > > > Thank you. > > > > > > > > Alex Donnini > > > > > > > -- > > > > > > Dianne Hackborn > > > > > > Android framework engineer > > > > > > [email protected] > > > > > > > Note: please don't send private questions to me, as I don't have > > > > > > time > > > to > > > > > > provide private support. All such questions should be posted on > > > public > > > > > > forums, where I and others can see and answer them. > > > > > -- > > > > Dianne Hackborn > > > > Android framework engineer > > > > [email protected] > > > > > Note: please don't send private questions to me, as I don't have time to > > > > provide private support. All such questions should be posted on public > > > > forums, where I and others can see and answer them. > > > -- > > ... > > read more » --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "android-framework" 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-framework?hl=en -~----------~----~----~----~------~----~------~--~---
