Re: [android-developers] Sprint 4G(WIMAX) tcp connection problem

2013-04-15 Thread Irfan Sheriff
On Mon, Apr 15, 2013 at 10:46 AM, Kostya Vasilyev kmans...@gmail.comwrote:




 2013/4/15 Robert Greenwalt rgreenw...@google.com




 On Mon, Apr 15, 2013 at 8:44 AM, Kostya Vasilyev kmans...@gmail.comwrote:

 Robert,

 Could you elaborate on the issues like these part? Are there changes
 in Android that developers should be made aware?


 By issues like these I just meant the inevitable bugs that will crop up
 when making software.  If there is a library on the platform that already
 does what you need it is risky to decide to create your own redundant code.



 Yes, I understand the inevitable bugs, but GTalk / GCM work with those
 bugs, perhaps becuase they do things a certain way.

 I've seen GTalk's service menu, it seems it has separate keep-alive logic
 for mobile vs. WiFi Why? I can't tell just by reading the Android
 networking docs.


I dont know what gtalk is doing, but a guess here is that wifi needs more
aggressive keep alives due to NAT time outs being low on some access points.






 I also have an app that uses long persistent server connection, and
 using GCM is not an option either.

 Can you elaborate on why GCM is not an option for you?  We want to make
 GCM useful, so if it's missing features or is not an option we want to
 know about it..


 I have a little email app.

 Unless someone can convince Gmail, Yahoo, GMX, AOL, Dovecot, Courier, and
 all the rest switch to GCM, I'm kind of stuck with IMAP IDLE, which is a
 terrible protocol, but at least it's there.




 It seems that with Android 4.1 and 4.2, connections often go dead --
 even though technically connected (at the server side), data pushed by the
 server stops getting through (this is verified by server logs).


 Is that just on WiMAX as the original poster suggested?


 I don't have / use WiMax, the case I and one of my users investigated with
 logging was WiFi.


 Do you have bugreports and/or packet captures?


 I have seen server logs captured by a very helpful user, and ran my own
 app with logging, on two devices with 4.2.2, connected to the same WiFi
 access point, and same mail server.

 The symptoms are -- I can outline them in just a few sentences.

 My Android code is in a socket read (in a worker thread, of course), the
 device goes to sleep, the connection stays up.

 The server sends small packets of data from time to time.

 When the device has been asleep for a while (5-8-10 minutes, IIRC) and the
 server sends data:

 - The app no longer wakes up and receives the data
 - The next socket write from the server results in a socket write error
 (so the first packet was not acknowledged)

 In the tests I ran, the connection was alive at my home router (it has a
 UI where I can see the connections).

 If the device was not allowed to go to sleep, the issue did not occur.





 Android 4.0 does not seem to suffer from these issues, at least not to
 the same extent.

 A Nexus 7 and a Galaxy Nexus running the same stock 4.2.2, connected to
 the same server, over the same WiFi network, will experience dead
 connections at different rates (confirmed by logging).


 Can you share a bugreport and packet capture?  There was no intention to
 kill long-lived connections in android, so if there is an issue with 4.2.*
 we need to hear about it.


 Don't have a packet capture, but will try to submit a bug report, since
 there seems to be interest on your part. Thank you for this.

 Are there any changes to WiFi power saving in 4.1 - 4.2, perhaps it tries
 to go deeper than before into some sort of sleep state?

 Is it possible that this power saving mode has a low-level bug, where the
 WiFi radio stops responding to incoming packets?

 Would this be related to this old issue? I can only guess of course:
 https://code.google.com/p/android/issues/detail?id=9781


This bug is a bit old.

Can you clarify what  android device and access point you are using. You
could send Robert or me an email with the details and the bugreport (a
packet capture showing the problem may be even better)

I ask because different wifi drivers do their own power optimizations and I
have seen issues where these optimizations do not work well with certain
access points. We have to chase these issues with the vendors.

There should not be generic issue like this on the platform itself - it is
depended on the wifi driver.

Thanks





 The suggestion to use GCM does not benefit everyone.


 It's nice that that Android has GTalk which provides GCM, and has its
 own keep-alive logic, but with it being closed source, and with apparent
 changes in recent Android versions, this leaves those developers who can't
 use GCM dead in the water.

 It would be great if someone from Google could comment, and explain,
 what's different in Android 4.1 - 4.2 with respect to long running
 connections, and what sort of magic is now required to keep them alive, for
 those apps that really need it.


 As I said above we did not intentionally do anything to break 

Re: [android-developers] Sprint 4G(WIMAX) tcp connection problem

2013-04-15 Thread Irfan Sheriff
On Mon, Apr 15, 2013 at 11:50 AM, Kostya Vasilyev kmans...@gmail.comwrote:




 2013/4/15 Irfan Sheriff isher...@gmail.com




 On Mon, Apr 15, 2013 at 10:46 AM, Kostya Vasilyev kmans...@gmail.comwrote:



 I've seen GTalk's service menu, it seems it has separate keep-alive
 logic for mobile vs. WiFi Why? I can't tell just by reading the Android
 networking docs.


 I dont know what gtalk is doing, but a guess here is that wifi needs more
 aggressive keep alives due to NAT time outs being low on some access points.


 I could see the connections still alive in my router's UI.

 Not letting the device go to sleep would make the issue go away (with no
 change at the router or NAT or server).

 Let me ask you this -- when WiFi goes into power saving mode, is there a
 specific upper bound on the time it takes to wake back up (either triggered
 by an incoming packet, or an outgoing one)?





 Don't have a packet capture, but will try to submit a bug report, since
 there seems to be interest on your part. Thank you for this.

 Are there any changes to WiFi power saving in 4.1 - 4.2, perhaps it
 tries to go deeper than before into some sort of sleep state?

 Is it possible that this power saving mode has a low-level bug, where
 the WiFi radio stops responding to incoming packets?

 Would this be related to this old issue? I can only guess of course:
 https://code.google.com/p/android/issues/detail?id=9781


 This bug is a bit old.


 It's the closest I could find, sorry. I vaguely recall seeing some newer
 ones about the same thing.



 Can you clarify what  android device and access point you are using. You
 could send Robert or me an email with the details and the bugreport (a
 packet capture showing the problem may be even better)


 I do not have a packet capture, I had server and app logs, and given that
 there are no packet captures, I already explained the gist of it (saving
 you having to read the logs).

 My devices were (and are) a Galaxy Nexus and a Nexus 7 with 4.2.2 (or
 4.2.1?, I worked on this a lot in mid-December of last year). The user's
 devices included a Galaxy Nexus with 4.1.

 My home router, at the time, was a Zyxel Keentic Giga, with an 80 MBit/s
 PPTP connection.




 I ask because different wifi drivers do their own power optimizations and
 I have seen issues where these optimizations do not work well with certain
 access points. We have to chase these issues with the vendors.


 Ok, so the bug is a bit old, but the issue remains to this day?


 I can appreciate the complexity of tracking these down, and glad someone
 is doing it, but...

 it does not help when users have but the latest Android version with
 the latest drivers with fixes (I presume).




 There should not be generic issue like this on the platform itself - it
 is depended on the wifi driver.


 Looking at it from an application's point of view, it makes no difference
 if it's the driver or the framework or the kernel code.

 To the user it's even more simple: does not work.

 Should there be a system level setting to turn off those power
 optimizations, if they're known to not be compatible with all (taken as a
 metaphorical term) access point / router devices?


There is. You could try turning off settings  wifi  advanced  wi-fi
optimization
 to see if it makes a difference.

The 
HIGH_PERFhttp://developer.android.com/reference/android/net/wifi/WifiManager.html#WIFI_MODE_FULL_HIGH_PERFAPI
also does the same and should be used with care due to power impact.


 -- K

  --
 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en
 ---
 You received this message because you are subscribed to the Google Groups
 Android Developers group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to android-developers+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.




-- 
-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Android Developers group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [android-developers] Sprint 4G(WIMAX) tcp connection problem

2013-04-15 Thread Irfan Sheriff
On Mon, Apr 15, 2013 at 12:24 PM, Kostya Vasilyev kmans...@gmail.comwrote:



 2013/4/15 Irfan Sheriff isher...@gmail.com



 On Mon, Apr 15, 2013 at 11:50 AM, Kostya Vasilyev kmans...@gmail.comwrote:



 Should there be a system level setting to turn off those power
 optimizations, if they're known to not be compatible with all (taken as a
 metaphorical term) access point / router devices?


 There is. You could try turning off settings  wifi  advanced  wi-fi
 optimization
  to see if it makes a difference.


 Thank you. I never noticed that before. Must be new in 4.2?






  The 
 HIGH_PERFhttp://developer.android.com/reference/android/net/wifi/WifiManager.html#WIFI_MODE_FULL_HIGH_PERFAPI
  also does the same and should be used with care due to power impact.


 Can you give an estimate how much more power this will consume?


I do not have the numbers with me now, but this really depends on the
driver and the environment (amount of traffic on air)

I believe in our tests at google, the idle power went up 5 times.


 -- K



-- 
-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Android Developers group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [android-developers] How to keep WiFi on and let screen go to sleep?

2013-04-10 Thread Irfan Sheriff
On Wed, Apr 10, 2013 at 8:03 AM, plnelson pna...@gmail.com wrote:

 I'm programming an Android device for use in an industrial environment
 where it needs to stay in touch with the server even when the screen goes
 to sleep. I thought I did all the right stuff but when the screen goes out
 it still sends a Fin to the server (confirmed on a network data packet
 sniffer).

 I know that to do a WifiLock I must also do a WakeLock, so, in my onCreate
 I do . . .

 private PowerManager.WakeLock wakelock;private WifiManager.WifiLock wifilock;

 . . .

 PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
 wakelock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, CPUOnly);
 wakelock.acquire();
 WifiManager wifiManager = (WifiManager) 
 getSystemService(Context.WIFI_SERVICE);
 wifilock = wifiManager.createWifiLock(WifiManager.WIFI_MODE_FULL, 
 WifiLock);
 wifilock.acquire();



Acquiring wifilock like this only makes sure the system does not shut down
wifi. The actual wifi connection still goes through power optimizations
once screen is off in the driver.

This should not drop your connections, but we have seen some vendor
driverss use optimizations that cause interop issues with certain access
points leading to heavy loss or drops.



 I read on the web that this doesn't work on some devices and you have to
 leave the screen on dim, so I replaced the line above with

  wakelock = pm.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK,
 CPUOnly);


 That worked in the sense that WiFi stayed on, but at the expense of
 leaving the screen on dimly.   Is there any workaround to this so the
 screen can go off but WiFi stay on?

 ALSO - this is on an Android 2.36 device, but the Android documentation
 says that as of API 17 SCREEN_DIM_WAKE_LOCK is deprecated and we're
 supposed to use FLAG_KEEP_SCREEN_ON, but that leaves the display on at *full
 brightness*!   So what are we supposed to do then?

 Thanks in advance!



  --
 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en
 ---
 You received this message because you are subscribed to the Google Groups
 Android Developers group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to android-developers+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.




-- 
-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Android Developers group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [android-developers] WiFi Direct connections drop during Bluetooth scan

2013-02-26 Thread Irfan Sheriff
On Tue, Feb 26, 2013 at 8:47 AM, Matt M matthew.mag...@gmail.com wrote:

 Hello,

 I made an application (for work, not for public use) that constantly runs
 a bluetooth scan to detect any nearby devices. The next phase of the
 application was to connect a few android


BT and Wi-Fi do interfere with each other and the firmwares on most devices
uses various techniques to avoid problems with this coex.

Running a  constant bluetooth scan is not a good idea - you may want to
revisit that and see how you can minimize the scans.

Do you see a drop everytime you do a single bluetooth scan ? What device is
this ?


  devices together so that could share the data they receive, to do this we
 purchased 3 Samsung Tabs to connect them via WiFi Direct.

 The problem is the WiFi Direct connections ALWAYS drop when my application
 is running (specifically running the bluetooth scan). When I do not run the
 bluetooth scan the WiFi Direct connections have not disconnected.

 Does anyone have any information that could help me here? Am I just out of
 luck and a bluetooth scan will always cause a WiFi Direct disconnect?

 Thank you,

 Matt.

 --
 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en
 ---
 You received this message because you are subscribed to the Google Groups
 Android Developers group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to android-developers+unsubscr...@googlegroups.com.

 For more options, visit https://groups.google.com/groups/opt_out.




-- 
-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Android Developers group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [android-developers] Re: Connecting to a wifi device from the android application

2013-02-07 Thread Irfan Sheriff
A scan is active at the framework and in the wpa_supplicant at a certain
interval. So, you do not really need to start a scan to connect - but doing
an explicit scan may start the connection right away.


On Thu, Feb 7, 2013 at 11:37 AM, Kostya Vasilyev kmans...@gmail.com wrote:

 I don't know what Reto's book says, but it's just that I've done a bit of
 work with WiFi on Android and that's my experience...

 ( most useless post of the day? )

 -- K

 On Thursday, February 7, 2013 10:48:13 PM UTC+4, bob wrote:

 I don't think you need to call startScan after calling enableNetwork.
  Here's what my book says:


 To use a particular network configuration, use the enableNetwork method,
 passing in the network ID to use and specifying true for the
 disableAllOthers parameter:

 // Get a list of available configurations

  List  WifiConfiguration  configurations = wifi.getConfiguredNetworks();

  // Get the network ID for the first one.

 if (configurations.size()  0) { int netID = configurations.get( 0).
 networkId;

  // Enable that network.
  boolean disableAllOthers = true;
  wifi.enableNetwork( netID, disableAllOthers);
  }

 Meier, Reto (2012-04-05). Professional Android 4 Application Development
 (Wrox Professional Guides) (Kindle Locations 17962-17968). John Wiley and
 Sons. Kindle Edition.



 On Thursday, February 7, 2013 11:50:42 AM UTC-6, Kostya Vasilyev wrote:

 That's half of it. The other half is calling WifiManager.startScan() to
 actually trigger the {re}connect.

 -- K

 On Thursday, February 7, 2013 8:52:05 PM UTC+4, bob wrote:

 I think you call this function in WifiManager:

 boolean
 *enableNetwork*(int netId, boolean disableOthers)
 Allow a previously configured network to be associated with.



 On Thursday, February 7, 2013 10:35:51 AM UTC-6, Raneez wrote:

 My application (supports 2.2 and later) needs to connect with a *wifi
 device* like 
 FlashAirhttp://www.toshiba-components.com/FlashAir/index.html after
 scanning networks using 
 WifiManagerhttp://developer.android.com/reference/android/net/wifi/WifiManager.html
 .

 Is it possible to connect to a device from the *application ? *or is
 it only possible by scanning and connecting devices from settings?

  --
 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en
 ---
 You received this message because you are subscribed to the Google Groups
 Android Developers group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to android-developers+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.




-- 
-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Android Developers group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [android-developers] W-Fi Connectivity Receiver

2012-12-21 Thread Irfan Sheriff
http://developer.android.com/reference/android/net/wifi/WifiManager.html#NETWORK_STATE_CHANGED_ACTION


On Fri, Dec 21, 2012 at 1:35 PM, BearTi mlrti...@gmail.com wrote:

 Hi,

 I need a broadcast-receiver which react on state changes of the wi-fi
 connectivity.
 I don´t want to get an intent when the wi-fi is enabled or disabled by the
 user...
 I just want a message when for the connection to one of the, in my phone
 configured wi-fi networks (supplicant), has been lost.

 I tried it with the ConnectivityManager.CONNECTIVITY_ACTION, but here I
 get more intens i need.

 Any idea? Thanks

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] W-Fi Connectivity Receiver

2012-12-21 Thread Irfan Sheriff
On Fri, Dec 21, 2012 at 1:54 PM, BearTi mlrti...@gmail.com wrote:

 I alos tried this, but here i only get a notify when the wi-fi function is
 being enabled/disabled... not when i lost the connection to a hotspot :-/


I do not follow you entirely - what do you mean by wi-fi function is
enabled/disabled ?

This intent includes NetworkInfo extra which will tell you everytime Wi-Fi
was connected or disconnected.




 Am Freitag, 21. Dezember 2012 22:44:41 UTC+1 schrieb Irfan Sheriff:

 http://developer.android.com/**reference/android/net/wifi/**
 WifiManager.html#NETWORK_**STATE_CHANGED_ACTIONhttp://developer.android.com/reference/android/net/wifi/WifiManager.html#NETWORK_STATE_CHANGED_ACTION


 On Fri, Dec 21, 2012 at 1:35 PM, BearTi mlrt...@gmail.com wrote:

 Hi,

 I need a broadcast-receiver which react on state changes of the wi-fi
 connectivity.
 I don´t want to get an intent when the wi-fi is enabled or disabled by
 the user...
 I just want a message when for the connection to one of the, in my phone
 configured wi-fi networks (supplicant), has been lost.

 I tried it with the ConnectivityManager.**CONNECTIVITY_ACTION, but here
 I get more intens i need.

 Any idea? Thanks

  --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-d...@**googlegroups.com

 To unsubscribe from this group, send email to
 android-developers+**unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/**group/android-developers?hl=enhttp://groups.google.com/group/android-developers?hl=en


  --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en


-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] WifiP2pManager.BUSY State

2012-11-07 Thread Irfan Sheriff
If its busy, it could be a previous connection or wifi still being enabled
or something that makes the operation infeasible at that time. Note that
p2p tear down can take up to 2 minutes when things fail.

You will have to just wait it out and retry if it happens. If you have
exact steps to repro this, I can take a look at the log.


On Wed, Nov 7, 2012 at 3:34 AM, Zach zachariah...@gmail.com wrote:

 sometime when I try to create a group in WifiDirect it returns back

 WifiP2pManager.BUSY

 message as reason for failure. I am not sure why this happens.

 But if I restart the WIFI interface it will again work. What could be the
 possible reason for this? How this can be avoided? is there any way to
 overcome this if it ever happens?

 Thanks

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Getting custom input/info from peer devices in WiFi Direct

2012-10-29 Thread Irfan Sheriff
On Tue, Oct 23, 2012 at 6:07 AM, A. Farhan clausn...@gmail.com wrote:

 Hello. I am new to this Android programming. Is it possible to display any
 custom data from other WiFi Direct peers other than client info?

 The scenario is like this:

 Client A  B uses WiFi Direct app with custom coding. The custom coding is
 an additional button to prompt for status text and stored it into a String
 variable. Let say client A sets his status msg I am online!. So, client A
 and B start connecting to each other. And my question is, Is it possible
 Client B to get the client A status message to be displayed in Client B
 WiFi Direct app?


Yes, look through WifiP2pManager discoverServices() and the related API
with callbacks for service advertising/discovery

  --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Re: WifiDirect with WifiDirect NSD

2012-10-24 Thread Irfan Sheriff
On Wed, Oct 24, 2012 at 7:11 AM, Zach zachariah...@gmail.com wrote:

 Hi,
 I made it work! Just swapped steps 2 and 3 on server
 So on server new order is

1. Initialize and Start WiFi Direct
2. Register a Local Service and Start Service Discovery
3. Start a Wifi Direct Group

 You are right about this. I need to document this better.

Thanks


 With old oder one thing I found was that the client was not getting any
 notification regarding a successful connection once a connection is
 established. But at the same time server receives notification that network
 is formed. So I assume that once connection was made by server the server
 may be passing some acknowledgement back to the client. With previous oder
 server was blocked some how. I am not 100% sure about my inference. If you
 think differently let me know.

 Thanks

 On Tuesday, October 23, 2012 5:38:46 PM UTC+1, Zach wrote:

 Hi,

 I am working on wifi direct with network service discovery. Heres what I
 do for that

 For a Server(Device which first starts)

1. Initialize and Start Wifi Direct
2. Start a WifiDirect Group
3. Register a Local Service and Start service discovery


 For a client(All devices which starts after the first one)

1. Initialize and Start wifi direct
2. Check for Group owners, store details of group owner found
3. If found Register local service and start service discovery
4. When new device info is available via NSD, checks whether its the
type of device expecting;add it to data structure
5. For all devices in data structure identify wifi direct group owner
and establish a connection with it


 Things go wrong from here, after establishing a connection I am expecting
 a call back to onConnectionInfo available; but it never happens on client
 device.

 If I am not starting NSD everything works fine. I am getting a callback
 to onConnectionInfo available immediately after connecting with remote
 device(GO).
 I was following this tutorial http://developer.**
 android.com/training/connect-**devices-wirelessly/nsd-wifi-**direct.htmlhttp://developer.android.com/training/connect-devices-wirelessly/nsd-wifi-direct.html

 Whats going wrong here?
 Many Thanks

  --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en


-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] WifiDirect with WifiDirect NSD

2012-10-23 Thread Irfan Sheriff
On Tue, Oct 23, 2012 at 9:38 AM, Zach zachariah...@gmail.com wrote:

 Hi,

 I am working on wifi direct with network service discovery. Heres what I
 do for that

 For a Server(Device which first starts)

1. Initialize and Start Wifi Direct
2. Start a WifiDirect Group
3. Register a Local Service and Start service discovery


 For a client(All devices which starts after the first one)

1. Initialize and Start wifi direct
2. Check for Group owners, store details of group owner found
3. If found Register local service and start service discovery
4. When new device info is available via NSD, checks whether its the
type of device expecting;add it to data structure
5. For all devices in data structure identify wifi direct group owner
and establish a connection with it


 Things go wrong from here, after establishing a connection I am expecting
 a call back to onConnectionInfo available; but it never happens on client
 device.

 If I am not starting NSD everything works fine. I am getting a callback to
 onConnectionInfo available immediately after connecting with remote
 device(GO).


wait, the callback to onConnectionInfo() comes only if you
requestConnectionInfo(). Do you mean you dont get a connection changed
broadcast ? Do you get peers changed broadcast which says what is going on
with various peers ?


 I was following this tutorial
 http://developer.android.com/training/connect-devices-wirelessly/nsd-wifi-direct.html

 Whats going wrong here?
 Many Thanks

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] WiFi Direct Group Creation with Multiple Devices

2012-10-18 Thread Irfan Sheriff
Each device will end up creating its own group if you do that.

You have the option doing createGroup() on one device and then calling
connect() from the other devices which will lead to all of them joining
that group.

On Thu, Oct 18, 2012 at 9:02 AM, Zach zachariah...@gmail.com wrote:

 Hi,
 I am doing some experiments with WiFi Direct. I was successful in creating
 a group and communication with each other(between 2 Devices) . I would like
 to know, say I have 10 devices and all starts to create a group, by calling
 createGroup functionality in WiFiP2Pmanager. Whether all devices will
 create independent groups, or just one group will be created among them?

 Can someone explain this please?
 Thanks

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] WifiP2pManager.ConnectionInfoListener onConnectionInfoAvailable (WifiP2pInfo info)

2012-10-16 Thread Irfan Sheriff
Do you see the peer status (WifiP2pDevice has a status field) as connected
when you listen P2P_PEERS_CHANGED_ACTION broadcast and request the peers ?

On Tue, Oct 16, 2012 at 5:11 AM, Zach zachariah...@gmail.com wrote:

 Hi
 I am working on wifi direct. After sending a connect request I was
 expecting a call back to the onConnectionInfoAvailable call back. But that
 wont happen always for some reason. And at times it takes a while when i
 finally receives a callback.

 What am i doing wrong here? Is this call back an acknowledgement for
 a successful/failed connection? I know the connect method has a callback
 and for me that always returns a success.

 How ca i do this properly? How to identify a successful connection is
 established or not?
 Thanks

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Disconnect from a WiFi Direct Group

2012-10-12 Thread Irfan Sheriff
On Fri, Oct 12, 2012 at 3:19 AM, Zachariah Tom zachariah...@gmail.comwrote:

 Hi,

 I want to disconnect from a wifi direct group after establishing a
 connection. I just want to move out silently without interrupting other
 clients that are already in connection with the Group owner.

 I use *manager.Connect()* method to establish a connection. But didnt see
 any methods to disconnect. Only other option i saw is *
 manager.removeGroup()*, but I guess this will remove the entire group and
 interrupt the existing network connection.

removeGroup() is what you need. It removes the group from your perspective
- it is up to the group owner to decide whether to remove the group after
the client has left or not. In case of android, a GO will keep the group
until all clients have gone.


 Inside the device settings. once connected I can disconnect by clicking it
 again. I want to achieve the same via code.


 I am using Samsung Nexus with JellyBean 4.1.1

 How can I do this properly?

 Thanks

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Disconnect from a WiFi Direct Group

2012-10-12 Thread Irfan Sheriff
On Fri, Oct 12, 2012 at 9:14 AM, Zach zachariah...@gmail.com wrote:

 Hi,
 Thanks for your reply.
 I was initially using removeGroup. But here is what happened
 A client calls remove group and he will be disconnected from the owner.
 But later when Group owner tries to remove the group, it goes to the
 OnFailure call back. So the only reason would be there is no group
 available to remove. I have to make this guess as I have only 2 devices
 with me.  What do you think about this situation?


There can be a delay of a few seconds b/w the time the client removes and
by the time the group owner realizes the client is gone and removes it

My guess is you are removing it just as the group has been removed
underneath on the GO - and so it returns a failure.  But that should be ok.
The group will go away without you doing anything on the GO side.

adb logcat should show you what is going on the group owner side.

Anyways I will give a test with more devices soon and I can make sure that
 removeGroup is only removing the group from clients perspective.

 Have you tested this before?
 Thanks

 On Friday, October 12, 2012 5:07:44 PM UTC+1, Irfan Sheriff wrote:



 On Fri, Oct 12, 2012 at 3:19 AM, Zachariah Tom zachar...@gmail.comwrote:

 Hi,

 I want to disconnect from a wifi direct group after establishing a
 connection. I just want to move out silently without interrupting other
 clients that are already in connection with the Group owner.

 I use *manager.Connect()* method to establish a connection. But didnt
 see any methods to disconnect. Only other option i saw is *
 manager.removeGroup()*, but I guess this will remove the entire group
 and interrupt the existing network connection.

 removeGroup() is what you need. It removes the group from your
 perspective - it is up to the group owner to decide whether to remove the
 group after the client has left or not. In case of android, a GO will keep
 the group until all clients have gone.


 Inside the device settings. once connected I can disconnect by clicking
 it again. I want to achieve the same via code.


 I am using Samsung Nexus with JellyBean 4.1.1

 How can I do this properly?

 Thanks

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-d...@**googlegroups.com

 To unsubscribe from this group, send email to
 android-developers+**unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/**group/android-developers?hl=enhttp://groups.google.com/group/android-developers?hl=en


  --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en


-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Checking if 5ghz wifi is available

2012-10-04 Thread Irfan Sheriff
On Wed, Oct 3, 2012 at 8:11 AM, Reductio Ad Absurdum timmj...@gmail.comwrote:

 Hi all,

 i'm desperatly searching for a method to figure out if a device running my
 app can actually use the 5Ghz wifi band.


There is no API. Why would you want this in an app ?



 Does anyone know how to do that?

 Thanks!

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Check support for wifi personal hotspot

2012-09-26 Thread Irfan Sheriff
There is no proper API for this.

On Tue, Sep 25, 2012 at 2:51 PM, Anders lanils...@gmail.com wrote:

 Does anyone know how an app may check whether a device supports wifi
 mobile hotspot/wifi tethering? For example, my Android phone has this
 functionality and you can tether the 3G connection, while my newer android
 tablet does not support it. To complicate things further, I actually have
 another tablet, with only wifi and no 3G that do support the portable
 hotspot mode.

 Please observe that I am not asking how to enable the hotspot, just
 whether the device has support for it.

 Thanks

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] *** FATAL EXCEPTION IN SYSTEM PROCESS: WifiWatchdogStateMachine

2012-09-20 Thread Irfan Sheriff
On Thu, Sep 20, 2012 at 9:03 AM, yogi yogeshk.bag...@gmail.com wrote:

 Hi Irfan,

 Thank you for the reply, i do not wish to manually provide ip address. i
 wish to fix the soft reboot issue which occur due to no default gatway
 address provided by certain AP for e.g. cisco ap 1252.
 refering to file *system/core/libnetutils/dhcp_utils.c *
 and refering to config parameter dhcp.wlan0.gatway which is refered in
 the dhcp_utils.c file, i need to know where i could


may be you can fix where the soft reboot happens and upload on open source
for us ?


 provide a default value for e.g. 0.0.0.0 something like init.rc

 to be specific can i provide the below in init.rc
 setprop dhcp.wlan0.gatway 0.0.0.0


we dont pick a default from the property. the property tracks the value
obtained from AP.



 Regards,
 yogesh




 On Wednesday, September 19, 2012 9:11:23 PM UTC+5:30, Irfan Sheriff wrote:

 Known issue. It will be fixed with an update.

 If you want to change config settings - you can use static IP by long
 pressing on a network and modifying it

 On Tue, Sep 18, 2012 at 5:51 AM, yogi yogeshk...@gmail.com wrote:

 hi,

 i get the below exception when trying to connect my test phone running
 JB with cisco ap 1252,
 seems like the issue is with cisco ap not providing default dhcp gateway
 or ip info due to which my test phone acting as STA does a soft reboot.
 is there a way i could specify default configuration parameters in case
 remote ap does not provide one.

 there is no issue if i uncheck *Avoid poor connections  *option in
 wlan advance settings i dont see below issue however when the setting is
 selected i wish to fix soft reboot issue.

 i am not using ipv6.

 logs
 ==

 W/dalvikvm( 2199): threadid=47: thread exiting with uncaught exception
 (group=0xb3550300)
 E/AndroidRuntime( 2199): *** FATAL EXCEPTION IN SYSTEM PROCESS:
 WifiWatchdogStateMachine
 E/AndroidRuntime( 2199): java.lang.**IllegalArgumentException: IPv6
 unsupported
 E/AndroidRuntime( 2199):  at android.net.arp.ArpPeer.init**
 (ArpPeer.java:62)
 E/AndroidRuntime( 2199):  at android.net.wifi.**
 WifiWatchdogStateMachine.**doArpTest(**WifiWatchdogStateMachine.java:**
 866)
 E/AndroidRuntime( 2199):  at android.net.wifi.**
 WifiWatchdogStateMachine.**access$2600(**WifiWatchdogStateMachine.java:*
 *89)
 E/AndroidRuntime( 2199):  at android.net.wifi.**
 WifiWatchdogStateMachine$**VerifyingLinkState.**processMessage(**
 WifiWatchdogStateMachine.java:**654)
 E/AndroidRuntime( 2199):  at com.android.internal.util.**
 StateMachine$SmHandler.**processMsg(StateMachine.java:**895)
 E/AndroidRuntime( 2199):  at com.android.internal.util.**
 StateMachine$SmHandler.**handleMessage(StateMachine.**java:756)
 E/AndroidRuntime( 2199):  at android.os.Handler.**
 dispatchMessage(Handler.java:**99)
 E/AndroidRuntime( 2199):  at android.os.Looper.loop(Looper.**java:137)
 E/AndroidRuntime( 2199):  at android.os.HandlerThread.run(**
 HandlerThread.java:60)
 Regards,
 Yogesh


 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-d...@**googlegroups.com

 To unsubscribe from this group, send email to
 android-developers+**unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/**group/android-developers?hl=enhttp://groups.google.com/group/android-developers?hl=en


  --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en


-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] *** FATAL EXCEPTION IN SYSTEM PROCESS: WifiWatchdogStateMachine

2012-09-19 Thread Irfan Sheriff
Known issue. It will be fixed with an update.

If you want to change config settings - you can use static IP by long
pressing on a network and modifying it

On Tue, Sep 18, 2012 at 5:51 AM, yogi yogeshk.bag...@gmail.com wrote:

 hi,

 i get the below exception when trying to connect my test phone running JB
 with cisco ap 1252,
 seems like the issue is with cisco ap not providing default dhcp gateway
 or ip info due to which my test phone acting as STA does a soft reboot.
 is there a way i could specify default configuration parameters in case
 remote ap does not provide one.

 there is no issue if i uncheck *Avoid poor connections  *option in wlan
 advance settings i dont see below issue however when the setting is
 selected i wish to fix soft reboot issue.

 i am not using ipv6.

 logs
 ==

 W/dalvikvm( 2199): threadid=47: thread exiting with uncaught exception
 (group=0xb3550300)
 E/AndroidRuntime( 2199): *** FATAL EXCEPTION IN SYSTEM PROCESS:
 WifiWatchdogStateMachine
 E/AndroidRuntime( 2199): java.lang.IllegalArgumentException: IPv6
 unsupported
 E/AndroidRuntime( 2199):  at
 android.net.arp.ArpPeer.init(ArpPeer.java:62)
 E/AndroidRuntime( 2199):  at
 android.net.wifi.WifiWatchdogStateMachine.doArpTest(WifiWatchdogStateMachine.java:866)
 E/AndroidRuntime( 2199):  at
 android.net.wifi.WifiWatchdogStateMachine.access$2600(WifiWatchdogStateMachine.java:89)
 E/AndroidRuntime( 2199):  at
 android.net.wifi.WifiWatchdogStateMachine$VerifyingLinkState.processMessage(WifiWatchdogStateMachine.java:654)
 E/AndroidRuntime( 2199):  at
 com.android.internal.util.StateMachine$SmHandler.processMsg(StateMachine.java:895)
 E/AndroidRuntime( 2199):  at
 com.android.internal.util.StateMachine$SmHandler.handleMessage(StateMachine.java:756)
 E/AndroidRuntime( 2199):  at
 android.os.Handler.dispatchMessage(Handler.java:99)
 E/AndroidRuntime( 2199):  at android.os.Looper.loop(Looper.java:137)
 E/AndroidRuntime( 2199):  at
 android.os.HandlerThread.run(HandlerThread.java:60)
 Regards,
 Yogesh


 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] How to modify WiFi Direct device name ?

2012-07-10 Thread Irfan Sheriff
There is no API to modify device name. JB adds a UI for this.

We will eventually have a single API that controls device name across BT,
wifi direct etc.,

On Wed, Jul 4, 2012 at 7:37 PM, Jaeyoung Soh acer...@gmail.com wrote:

 Hello, everyone.

 I'm doing implement WiFi direct app between two Android devices with
 reference below API guide.

 http://developer.android.com/guide/topics/connectivity/wifip2p.html

 I want to set the WiFi direct device name  as my wish  through the my
 app.
 And that when my app try to connect(WifiP2pManager.connect) other Android
 device, I would like to do that device let know that connecting request is
 form my app.
 For this scenario, first it should be possible - I can modify my WiFi
 direct device name.

 Also, I know that some Samsung Galaxy Series support to modify WiFi direct
 settings include device name.
 But I want some solution by ICS Api level for all Android ICS devices
 Please let me know if there is some solution..

 Thanks in advance.

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Turn-on WifiDirect programmatically and set a WPA password?

2012-07-10 Thread Irfan Sheriff
On Tue, Jul 10, 2012 at 8:00 AM, Charx evertvdbr...@gmail.com wrote:

 Dear Android Developers,


1. I searched through the whole WifiDirect API android.net.wifi.p2p
but i could not find a way to enable/disable the WifiDirect function
programmatically. Does somebody know a way or is this feature not possible?


No. JB supports concurrent STA  Wifi Direct operation and going forward
devices are required to do this which means wifi direct is enabled by
default




1. Also is it possible to create a WPA connection password so that the
host does not have to aprove/permit every device trying to connect.


Not right now.



 Kind regards,

 Charx

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Turn on wifi direct on XOOM

2012-05-01 Thread Irfan Sheriff
Wifi Direct can be enabled on the wingray by adding the following line to
 device/moto/wingray/device_base.mk:

frameworks/native/data/etc/android.hardware.wifi.direct.xml:system/etc/permissions/android.hardware.wifi.direct.xml

But officially, Wifi Direct is not supported on BCM4329 because of firmware
limitations. It will likely not work very well.

Thanks

On Tue, May 1, 2012 at 5:10 PM, fan zhang fzhang...@gmail.com wrote:

 Robert:

 Do you know whom I should contact in Broadcom  to discuss this issue?

 Thanks

 Fan
 On Tue, May 1, 2012 at 4:59 PM, Robert Greenwalt rgreenw...@google.comwrote:

 You are welcome to discuss it with broadcom.  I agree that the hardware
 is capable.


 On Tue, May 1, 2012 at 4:52 PM, fan zhang fzhang...@gmail.com wrote:

 Robert:

 http://www.youtube.com/watch?v=H-BxARQZbbE

 Broadcom shows off WiFi Direct on a Motorola Xoom. So I believe that
 wifi hardware in xoom already supported wifi direct, right?

 Thanks

 Fan

 On Tue, May 1, 2012 at 4:23 PM, Robert Greenwalt 
 rgreenw...@google.comwrote:

 I don't think so.  It's a driver limitation and that source is not
 available.


 On Tue, May 1, 2012 at 4:18 PM, fan zhang fzhang...@gmail.com wrote:

 Could we do any patch to make it work?

 Thanks

 Fan

 On Tue, May 1, 2012 at 4:11 PM, Robert Greenwalt 
 rgreenw...@google.com wrote:

 Sorry - wifi direct is not supported on xoom.

 On Tue, May 1, 2012 at 3:59 PM, fan zhang fzhang...@gmail.comwrote:

 Hi:

 I installed ICS 4.0.3 to Moto XOOM wifi-only (wingray). However, I
 could not turn on wifi direct on XOOM.

 Did any one successfully turn on wifi direct on XOOM?

 Thanks

 Fan

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to
 android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en


  --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to
 android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en


  --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to
 android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en


  --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to
 android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en


  --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en


  --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en


  --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en


-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Where to find WIFI Direct technical materials?

2012-04-08 Thread Irfan Sheriff
http://developer.android.com/guide/topics/wireless/wifip2p.html

On Sun, Apr 8, 2012 at 5:09 AM, mxd nicefut...@126.com wrote:


  I'd like to get more familiar with WIFI Direct's Protocol and OTA Flow.
 I searched google, but cannot seem to find any materials which discuss the
 protocol in detail. At least not for free. Does anyone know where can I
 find such articles?

 I know WIFI Alliance, the spec is not free. Actually, i did not need the
 full spec. i only need some documents which explain the WIFI more detaily
 from technical aspect, include the discovery, connect, negotiate, ip
 address assigement, gourp create/remove.procedure flow. any one can
 share it?

 --
 *Best regards!*

 *Mao,Xiaodong*



  --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Can WIFI Direct and 3G Data Session Concurrently Work?

2012-04-08 Thread Irfan Sheriff
On Sun, Apr 8, 2012 at 5:08 AM, mxd nicefut...@126.com wrote:

   Can 3G Data Session and WIFI Direct concurrently work?? if so, then two
 IPaddress Exist, will it cause confusion? one example:


Yes, Wi-Fi direct uses a local IP that will not conflict with 3g
connectivity.


  A use 3G to download a video file, now the progress is 50%. Now A select
 a picture, and want to use WIFIDirect to share to B. will this succeed
 without interrupt the video file downloading?? say the WIFI connection is
 ok, then A have 2 Ip address, in Picture sharing , which Ip Address will be
 used?


 --
 *Best regards!*

 *Mao,Xiaodong*



  --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] WiFi-Direct hardware question

2012-04-03 Thread Irfan Sheriff
On Tue, Apr 3, 2012 at 8:50 PM, Kiran kiran.ka...@gmail.com wrote:

 Hi All,
 I've seen quite a few discussions on Wifi-Direct, but haven't found the
 answer to the following question.

 In the Android 4.0.x API, it says that *Note:* Not all Android-powered
 devices support Wi-Fi Direct. If your application uses Wi-Fi Direct,
 declare so with a 
 uses-featurehttp://developer.android.com/guide/topics/manifest/uses-feature-element.html
  element
 in the manifest file:

 Is there a list of Android powered devices which support WiFi-Direct
 currently?  Does the Samsung Galaxy Nexus S support it?  What hardware is
 required by the phone in order to support this feature?


BCM4329 does not support it (nexus s is bcm4329 based).

BCM4330 based devices can support it (Though, the ICS based broadcom driver
on galaxy nexus has known stability issues). I dont know much about other
chipsets.



 Thanks in advance,
 Kiran

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Access Point Change detection

2012-03-28 Thread Irfan Sheriff
On Wed, Mar 28, 2012 at 8:28 AM, Kostya Vasilyev kmans...@gmail.com wrote:

 When the connectivity changes, some (it seems most) firmwares force-close
 any currently open connections, but some do not (two examples: Motorola
 Milestone with 2.1, and a much more recent HTC Incredible S with 2.3...).


We have had fixes around resetting connections with connectivityservice
controlling it now.

It would be good to know if there are devices beyond ICS that still have
issues around not resetting socket connections when a network goes away.

Ideally, apps should not have to listen to any broadcasts to handle network
switches and should get resets on an existing socket.

Irfan



 Given the latter, I, too, had to implement code to close and reopen TCP/IP
 sockets upon connectivity changes.

 On the surface, it's pretty simple: just watch for CONNECTIVITY_ACTION.
 But, as it often happens, it's complicated by various device- and firmware-
 specific  erm... quirks...

 In particular, I've seen firmwares send a DISCONNECT event for a
 connection type that was disabled a long time ago (like, disconnect Mobile,
 connect WiFi, then five minutes later - hey, we're disconnected from
 Mobile, really). I've seen a CONNECT event for WiFi being sent twice when
 swtiching from Mobile, the first time being before the new connection is
 usable.

 CONNECTIVITY_ACTION events are also sent for network types that have
 nothing to do with general purpose Internet connectivity, such as TYPE_SUPL
 which can come and go without affecting the Internet.

 So, to summarize:

 1) you're on the right track with CONNECTIVITY_ACTION but expect to do a
 lot of testing and debugging before it really works.

 2) based on my experience, watching WifiManager events isn't necessary to
 detect general purpose connectivty changes.

 And finally, if your code misses messages, it means that your
 store-and-send logic isn't implemented correctly. Debug and fix it.

 -- K


 On 03/28/2012 02:57 PM, Hera wrote:

 favorite
 share [g+] share [fb] share [tw]

 Hello,

 My application has to open a socket and send/receive some message to
 the server. This works fine but the problem is when I move inside the
 building, then the device changes from one access points to the other
 (same wifi network). In that moment, I have (1) to store the messages,
 (2) create again the socket and (3) send stored messages. I not able
 to recognize that moment and I am not storing all the messages. I
 detect “A Connection timed out” exception in the BufferedReader and
 then I start storing messages.

 I have tried to detect that moment by this registering to this Intents
 but I am still missing messages:

 //To detect Connectivity changes.
 cmIntent.addAction(**ConnectivityManager.**CONNECTIVITY_ACTION);
 cmReceiver = new connectionChangeReceiver();
 context.registerReceiver(**cmReceiver, cmIntent);
 intentFilter intentFilter = new IntentFilter();
 intentFilter.addAction(**WifiManager.SUPPLICANT_**
 CONNECTION_CHANGE_ACTION);
 intentFilter.addAction(**WifiManager.NETWORK_STATE_**CHANGED_ACTION);
 intentFilter.addAction(**WifiManager.SUPPLICANT_STATE_**CHANGED_ACTION);
 context.registerReceiver(**cmReceiver, intentFilter);

 Thank you so much


 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to 
 android-developers@**googlegroups.comandroid-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+**unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/**group/android-developers?hl=enhttp://groups.google.com/group/android-developers?hl=en


-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Access Point Change detection

2012-03-28 Thread Irfan Sheriff
  It would be good to know if there are devices beyond ICS that still have
 issues around not resetting socket connections when a network goes away.


 Beyond ICS? I don't know what this means.

 My flagship Galaxy Nexus still hasn't received 4.0.3.

 And what do you mean by would be good to know?

 Should we, developers, and our users, moonlight as Android's test
 department?


I think we dont have a CTS around this behavior. I will look at filing a
bug internally for this to ensure things remain sane going forward.

Thanks





 Ideally, apps should not have to listen to any broadcasts to handle
 network switches and should get resets on an existing socket.


 Not ideally -- really -- apps are supposed to work on more than the 1.6%
 of devices with ICS.

 And beyond ICS - what portion of the market is that, at this time,
 exactly?

 -- K


 Irfan


  --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en


-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] android.permission.ACCESS_WIFI_STATE or android.permission.WAKE_LOCK for wifi lock

2012-03-26 Thread Irfan Sheriff
What else are you doing  ACCESS_WIFI_STATE is needed for most of the Wi-Fi
API

On Mon, Mar 26, 2012 at 4:28 AM, DraganA dand...@gmail.com wrote:

 Hi there,

 the documentation (http://developer.android.com/reference/android/net/
 wifi/WifiManager.WifiLock.html) clearly says that in order to acquire
 and lock Wifi state android.permission.WAKE_LOCK is needed in the
 manifest.
 Now, in Dev. console I'm getting errors from some users that goes
 like:
 java.lang.SecurityException: WifiService: Neither user 10078 nor
 current process has android.permission.ACCESS_WIFI_STATE.

 So, I'm not sure which one is it. I'm not very keen just to ask for a
 new permission if I don't really need to.

 Thanks

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Wifi manager woes

2012-03-26 Thread Irfan Sheriff
if reconnect is failing - the device is likely hitting failures in
driver/supplicant

On Sun, Mar 25, 2012 at 10:54 PM, Put_tiMe putt...@gmail.com wrote:

 Based on some events, I'm trying to switch on or off wifi.


 Switching wifi off works well. But while switching on wifi, 95% of the
 time, it can't reconnect to my previous wifi network.
 If I goto the settings - wifi, then I see that it's trying to connect,
 and after a while it'll disconnect.
 But wifi service is on.

 Sometimes 'reconnect' call returns false.


 I went to the extent of waiting until the wifi service is switched on,
 before reconnecting.

 Any idea as to how I can reconnect to my previous (or any) wifi network.


 onEvent_SwitchOn()
 {
  WifiManager wifiManager =
 (WifiManager)context.getSystemService(Context.WIFI_SERVICE);
 android.text.format.Time cTime = new android.text.format.Time();
  android.text.format.Time nTime = new android.text.format.Time();

  if(!wifiManager.setWifiEnabled(true)) {
   Log.e(Err, setWifiEnabled - true, failed);
  }

 // wait for about 5 seconds until wifi service is actually switched on
 cTime.setToNow();
  nTime.setToNow();
  while(true)
  {
   long diff = nTime.toMillis(true) - cTime.toMillis(true);
   if(diff  5000)
   {
break;
   }
   int  state = wifiManager.getWifiState();

   if(wifiManager.WIFI_STATE_ENABLED == state)
   {
break;
   }

   try {
Thread.currentThread().sleep(100);
   } catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
   }

   nTime.setToNow(); // update to the latest time
  }


 if(!wifiManager.reconnect()) {
   Log.e(Err, Wifi manager (reconnect) failed);
  }

 }

 }


 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Re: Current mobile connection speed?

2011-12-14 Thread Irfan Sheriff
Trying to predict if network is slow based on network type is incorrect - a
poor wifi connection can be really slow

It is better to just keep it simple and let the user always know the actual
progress without worrying about what the network speed is.

2011/12/14 Kostya Vasilyev kmans...@gmail.com

 As useful as this code is

  what if the phone switches from EDGE to HSPA right after the user
 clicks Login?

 What if it switches from WiFi to GPRS?

 Try to predict the network is somewhat useful, but it's really a
 Schrodinger's Cat type of thing :)

 Since network conditions can vary rapidly and dramatically, I'd
 recommend making sure there is a good UI with clear progress
 indication, timeout, and maybe a cancel button.

 -- Kostya

 14 декабря 2011 г. 15:49 пользователь Yahel kaye...@gmail.com написал:
  Not exactly what you ask for but this is how I do it.
 
  I'm not trying to be specific about the speed in kbs of the connection
  because it can change a lot due to the user moving from cell to cell.
  So I simply detect what kind of mobile connection we are on and send a
  slow connection warning only when connected via EDGE or GPRS.
 
  Here is the code that returns true if the connection is a slow one :
 
 public boolean internetConnectionIsLowSpeed() {
 ConnectivityManager connec = (ConnectivityManager)
  getSystemService(Context.CONNECTIVITY_SERVICE);
 
 if (connec.getActiveNetworkInfo()==null) return(false);
 
 
 if
  (connec.getActiveNetworkInfo().getType()==ConnectivityManager.TYPE_WIFI)
  {
 return(false);
 }
 
 if
 
 (connec.getActiveNetworkInfo().getType()==ConnectivityManager.TYPE_MOBILE)
  {
 
 
  switch(connec.getActiveNetworkInfo().getSubtype()) {
 case TelephonyManager.NETWORK_TYPE_GPRS :
 return(true);
 case TelephonyManager.NETWORK_TYPE_EDGE :
 return(true);
 case TelephonyManager.NETWORK_TYPE_UMTS :
 return(false);
 case
 TelephonyManager.NETWORK_TYPE_UNKNOWN : return(false);
 default : return(false);
 
 }
 }
 
 return(false);
 }
 
  --
  You received this message because you are subscribed to the Google
  Groups Android Developers group.
  To post to this group, send email to android-developers@googlegroups.com
  To unsubscribe from this group, send email to
  android-developers+unsubscr...@googlegroups.com
  For more options, visit this group at
  http://groups.google.com/group/android-developers?hl=en

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en


-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Future Wifi Direct service discovery in Android 4.0

2011-11-29 Thread Irfan Sheriff
Service discovery is not supported yet - device discovery and connection
set up is.

Thanks

On Tue, Nov 29, 2011 at 2:15 AM, Sheph ishai...@gmail.com wrote:

 Hello ,

 I would like to get a bit more information or references to resources
 regarding Wifi Direct service discovery in Android 4.0 .

 Will I be able as a developer to expose a regular android service on a
 p2p network dynmaically (by code) so other people around me can
 discover that applicative service and connect to it or its something
 more for use by hardware manufactures (printers , cameras ) ?

 Regards ,

 Sheph


 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Android WifiLock WIFI_MODE_SCAN_ONLY not working

2011-10-28 Thread Irfan Sheriff
The system can always override to make a connection. scan only wifilock
ensures wifi is not shutdown and kept up for scans.

On Thu, Oct 27, 2011 at 4:14 AM, Vasco Fernandes 
vasco.m.fernan...@gmail.com wrote:

 Hi,

 I'm trying to block the wifi connections. I want my application to turn on
 the wifi, but does not connect to any network that is already stored on the
 smartphone. But even after I use the SCAN_ONLY mode, he continues to connect
 to networks that already know.

 .
 wifiManager = (WifiManager)
 context.getSystemService(Context.WIFI_SERVICE);
 .
 wifiManager.setWifiEnabled(true);
 WifiLock scanOnly =
 wifiManager.createWifiLock(WifiManager.WIFI_MODE_SCAN_ONLY, scanOnly);

  scanOnly.acquire();

 Already in despair i tried to disconnect after to make sure that the state
 is WIFI_STATE_ENABLED wifi. That the app can not connect for a few seconds,
 but after some time it connects to a network in the same ...

 wifiManager.setWifiEnabled(true);
 
 WHEN (WIFI STATE == WIFI_STATE_ENABLED)
 {wifiManager.disconnect();
 scanOnly.acquire();}

 Can someone help me?
 Tks

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Service Discovery is not happening when screen is off

2011-08-12 Thread Irfan Sheriff
If it is related to multicast packets getting dropped, try creating a multicast
lockhttp://developer.android.com/reference/android/net/wifi/WifiManager.MulticastLock.html

If needed, use the WIFI_MODE_FULL_HIGH_PERF mode with care to avoid
driver optimizations at screen off.

Thanks
On Fri, Aug 12, 2011 at 3:56 AM, SREEHARI harisre...@gmail.com wrote:

 Hi,

 My application runs a service which can announce the Upnp discovery
 through Wifi. The device is getting discovered in Cling work bench.
 But when the screen is off, the device is not getting discovered. I
 tried Wakelock and Wifilock, but still its not working. I changed the
 sleep policy in Wifi settings also.

 I tried this application in 3 phones. In Samsung galaxy fit with
 Android 2.2, it works fine. In screen off mode also the device is
 getting discovered. in Nexus S and HTC wildfire S with Android 2.3.3
 its not happening. Is this the problem with Wifi state change or
 something else?? Please help me on this.

 Thanks in advance,
 Sreehari

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Re: Wifi lock with WIFI_MODE_SCAN_ONLY

2011-06-02 Thread Irfan Sheriff
Holding a scan wifilock ensures you get alteast scan capabilities and keeps
wifi up - the system is still in control of whether wifi needs to connect
when its turned on

On Wed, Jun 1, 2011 at 10:38 PM, seema seema22...@gmail.com wrote:

 Hello All,

   Here is what I do to scan on wifi while connected to 3G.

 WifiLock wifiLock =
 wifiService.createWifiLock(WifiManager.WIFI_MODE_SCAN_ONLY,
 MyLock);

if(!wifiLock.isHeld()){
wifiLock.acquire();
}

if(wifiService.isWifiEnabled() == false){
 wifiService.setWifiEnabled(true);
 }

 Is my usage of WIFI_MODE_SCAN_ONLY is correct. When I enable Wifi,
 it automatically connects to the remembered network. I just want
 to scan but not connect. The definition of WIFI_MODE_SCAN_ONLY is:
 In this Wi-Fi lock mode, Wi-Fi will be kept active, but the only
 operation that will be supported is initiation of scans, and the
 subsequent reporting of scan results.

 Please help me

 Regards,
 Seema

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] WifiLock and WakeLock regarding large downloads

2011-03-28 Thread Irfan Sheriff
WifiLock keeps the device on Wifi and prevents the device policy of shutting
down wifi and switching to 3g after 15 minutes of screen off.

Holding a wifilock should normally be sufficient to complete a download
since even in the power optimized state (screen off), the device should
still wake up on packet reception and they should get handled by the device
- though the packet loss in screen off state tends to be higher and the
download will be slower.

If you want to ensure the cpu is awake the whole time, you can hold a
wakelock as well.

Thanks

On Mon, Mar 28, 2011 at 10:31 AM, Mark Carter mjc1...@googlemail.comwrote:

 From what I gather, WifiLock and WakeLock work completely independently and
 if you are downloading a large file over Wifi then you will need to acquire
 both locks??

 Ideally, you would want something like this:

 1. Acquire partial WakeLock
 2. Preparing to download large file, check whether on Wifi or not.
 3. If on Wifi, then acquire WifiLock. If not, then prevent device switching
 to Wifi (is this possible?)
 4. Start download
 5. When download has finished, release all locks.

 Is this correct?

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] WifiLock and WakeLock regarding large downloads

2011-03-28 Thread Irfan Sheriff
On Mon, Mar 28, 2011 at 8:06 PM, Mark Carter mjc1...@googlemail.com wrote:

 Thanks Irfan. Doesn't the CPU need to be awake the whole time anyway? If it
 isn't, then won't the download stop/pause as soon as the CPU sleeps? If
 that's true, then isn't the WakeLock essential?


If you have initiated a download and the packets are being received by the
device, the CPU will end up being awake the whole time. If for some reason
the connection is flaky (say the device disconnected and reconnected) which
causes the packets to come in infrequently, the CPU might sleep, but should
be woken up on packet reception. In either case, you might be fine without a
wakelock.


 Also, what happens if the Wifi lock is acquired when the device is not
 using Wifi (I mean Wifi is enabled but it is not connected to any access
 point) - does that then make the Wifi lock redundant?


No. Holding a wifilock will mean that the device will connect to an access
point if it sees one come up. Without a wifilock, the device shuts down Wifi
15 minutes after screen off (by default) - so it wont even attempt to
connect to an access point without a wifilock.


 I must confess I don't fully understand the reasoning behind a WifiManager.

 As a developer, I want a lock that says:

 Keep awake the current internet connection until the download has
 finished

 and that lock would also prevent the device from sleeping.

 I don't care if it's over Wifi, mobile internet or wired or whatever. I
 might want to check if it's mobile internet so I can warn the user about
 potential high data volume costs, but that's different.


Normally, you should not need to hold a Wifilock in an app if you do not
care what the connection is.  As for an active download connection - I do
not think you need to do anything special here - with an incoming packet,
the device should be woken up and get handled.

The device can switch from wifi to 3g without a WifiLock (this can anyway
happen when wifi disconnects for some reason). You can listen to
ConnectivityManager broadcasts to detect when the device switches to a
different network (say if you want to stop a large download when the user is
on 3g).

The WifiLock is meant for apps that specifically do care about being on Wifi
even after device goes to sleep.

Irfan




 On 29 March 2011 09:41, Irfan Sheriff isher...@gmail.com wrote:

 WifiLock keeps the device on Wifi and prevents the device policy of
 shutting down wifi and switching to 3g after 15 minutes of screen off.

 Holding a wifilock should normally be sufficient to complete a download
 since even in the power optimized state (screen off), the device should
 still wake up on packet reception and they should get handled by the device
 - though the packet loss in screen off state tends to be higher and the
 download will be slower.

 If you want to ensure the cpu is awake the whole time, you can hold a
 wakelock as well.

 Thanks


 On Mon, Mar 28, 2011 at 10:31 AM, Mark Carter mjc1...@googlemail.comwrote:

 From what I gather, WifiLock and WakeLock work completely independently
 and if you are downloading a large file over Wifi then you will need to
 acquire both locks??

 Ideally, you would want something like this:

 1. Acquire partial WakeLock
 2. Preparing to download large file, check whether on Wifi or not.
 3. If on Wifi, then acquire WifiLock. If not, then prevent device
 switching to Wifi (is this possible?)
 4. Start download
 5. When download has finished, release all locks.

 Is this correct?

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en





-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Re: Bluetooth killer availabled in Android ? - WiFi Direct

2011-03-14 Thread Irfan Sheriff
Its in active development at this time. Nothing in the SDK for developers
right now.

Irfan

On Sun, Mar 13, 2011 at 1:19 AM, KJ kevjon...@hotmail.com wrote:

 I haven't yet seen anything in the Android SDK relating to Wi-fi
 Direct...does anyone yet have any info on using this technology on the
 Android devices supporting wifi direct?  Or is this a technology
 reserved for the devices' built in apps and not something readily
 available to developers?

 On Feb 21, 7:32 am, Wil Lai wil.tf...@gmail.com wrote:
  I saw from web that there's a newly technology for nearby instant
  connection which is called WiFiDirect.
  After my research, I found that Wi-FiDirectis based on traditional
  Wi-Fi so that all the currently Wi-Fi supported products are available
  to connect to aWiFiDirectsupported host.
  To speak to words short, Wi-FiDirectis a bluetooth-like technology
  which provide a more stable, longer-distance and faster connection.
 
  And there are two android devices supporting Wi-FiDirectnow! One is
  LG optimus Black which I found a video demo on that:
 http://www.viddler.com/explore/engadget/videos/2313/
 
  What I saw in the video is that after setting up the Wi-Fidirectin
  each device, there's an app for the transmission of files/video/
  images.
 
  When I search for android SDK I found nothing about Wi-FIDirect(the
  closest one is WifiManager). So I just wonder does anybody know
  anything about Wi-FiDirectsdk/framework/open library on Android ?

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en


-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Wifi sleeps... even with lock

2011-03-02 Thread Irfan Sheriff
a quick note about wifilocks today. We have two locks today WIFI_MODE_FULL
and WIFI_MODE_SCAN_ONLY.

The full lock thats used by default on a createWifiLock() keeps wifi up at
all times but it does not control the driver level power optimizations that
are done on devices. When screen goes off, drivers changes settings to
reduce power usage on wifi. This can lead to wifi getting disconnected or
the packet loss and delay increase when the screen is off.

For application scenarios, where we need the best wifi performance at all
times (a VoIP call in progress) as an example, we are going to add a new
lock type that will disable the power optimizations in the driver (if the
driver supports its). This will be out in the next release and can be used
at times when  wifi performance is criticial

Thanks

On Tue, Mar 1, 2011 at 6:37 AM, J javier.sed...@gmail.com wrote:

 Hi, friends,

 let's see if someone can help me.

 Summary: even when wifi lock is adquired, when the phone is running on
 batteries, wifi is disconnected after a while.

 I've simplified the problem to a single activity with a button that
 launches a thread. It just sends 100.000 strings to an echo server
 running on a PC (one string every 100ms). See code below. I can see
 the traffic with Wireshark, and also the echo server shows the
 strings. Notice how wifi and power locks are adquired before starting
 to send (and released after, of course).

 However, when the phone is running on battery and the user turns off
 the phone, it keeps sending strings for some time and then wifi is
 disconnected and the phone does not even respond to ping. It takes
 from 600s to 6000s to be disconnected (the figures are that round, so
 I think they are important).

 It perfectly works when ac is connected, so I guess it is somehow
 related to power management.

 To test it I just launch the activity, start the echo server, start
 Wireshark, press the Start button (android:onClick=doStart),
 blocks the phone and let it on the table. I go for lunch or whatever
 and after 600-6000s I can see the tx errors on Wireshark, the echo
 server has stopped receiving traffic and the phone does not respond to
 ping.

 The phone is 2.2, with Wifi policy set to sleep after 15m.


 Any idea?




 public class Test extends Activity {
  PowerManager _powerManagement = null;
  PowerManager.WakeLock _wakeLock = null;
  WifiManager.WifiLock _wifiLock = null;

  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
  }

  public void doStart(View v) {
DoerThreadFake t = new DoerThreadFake();
t.start();
  }

  private class DoerThreadFake extends Thread {
public void run() {
  runOnUiThread(new Runnable() {
public void run() {
  ((Button) findViewById(R.id.start)).setText(Doing...);
}
  });
  _keepOnStart();
  Socket s;
  byte[] buffer = new byte[1000];

  try {
s = new Socket(192.168.0.16, 2000);
PrintStream ps = new PrintStream(s.getOutputStream());
InputStream is = s.getInputStream();
for (int i = 0; i  10; i++) {
  ps.println(System.currentTimeMillis() +(+(new
 Date()).toString() +) :  + i);
  try {
Thread.sleep(100);
  } catch (InterruptedException e) {
e.printStackTrace();
  }
  while (is.available()  0) {
int a = is.available();
if (a  1000) a = 1000;
is.read(buffer, 0, a); // Clean echo
  }
}
  } catch (UnknownHostException e) {
e.printStackTrace();
  } catch (IOException e) {
e.printStackTrace();
  }
  _keepOnStop();
  runOnUiThread(new Runnable() {
public void run() {
  ((Button) findViewById(R.id.start)).setText(Done);
}
  });
}

private void _keepOnStart() {
  if (_powerManagement == null) {
_powerManagement = (PowerManager)
 getSystemService(Context.POWER_SERVICE);
  }
  if (_wakeLock == null) {
_wakeLock =
 _powerManagement.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK |
 PowerManager.ACQUIRE_CAUSES_WAKEUP | PowerManager.ON_AFTER_RELEASE,
0 Backup power lock);
  }
  _wakeLock.acquire();
  WifiManager wifiManager = (WifiManager)
 getSystemService(Context.WIFI_SERVICE);
  if (wifiManager != null) {
_wifiLock = wifiManager.createWifiLock(0 Backup wifi lock);
_wifiLock.acquire();
  }
}

private void _keepOnStop() {
  if ((_wifiLock != null)  (_wifiLock.isHeld())) {
_wifiLock.release();
  }
  if ((_wakeLock != null)  (_wakeLock.isHeld())) {
_wakeLock.release();
  }
}
  }
 }




 ?xml version=1.0 encoding=utf-8?
 manifest
  xmlns:android=http://schemas.android.com/apk/res/android;
  package=Odroid.test
  android:versionCode=1
  android:versionName=1.0
 

Re: [android-developers] Android 2.2 - Portable Hot Spot - WifiManager class

2010-11-09 Thread Irfan Sheriff
We dont expose the hotspot APIs for use by applications yet. They are not
final and likely to break in the future.

Irfan

On Tue, Nov 9, 2010 at 12:58 PM, Mark Murphy mmur...@commonsware.comwrote:

 They are not part of the public SDK at present. If you look at the
 source code, you will see they all have the @hide annotation. They
 might be introduced in the future, but for the moment they are hidden,
 perhaps because the API is unstable.

 On Tue, Nov 9, 2010 at 5:04 AM, Phil p...@surfsoftconsulting.com wrote:
  I'm looking at how Android supports wifi portable hot spot
  functionality with a view to writing simple home screen widget that
  allows people to turn the phone's wifi hotspot on and off without
  digging into the device settings.
 
  There was nothing obvious at developer.android.com so I dug through my
  copy of the Android source code and found that the WifiManager class
  (android.net.wifi.WifiManager) provides the basics to allow the state
  to be queried. So as well as 'getWifiState()' there is
  'getWifiApState()' and a matching set of state constants.
 
  However, in my bang-up-to-date Eclipse IDE, this class has none of the
  Ap methods or constants. Can anyone shed any light on this?
 
  Thanks,
  Phil.
 
  --
  You received this message because you are subscribed to the Google
  Groups Android Developers group.
  To post to this group, send email to android-developers@googlegroups.com
  To unsubscribe from this group, send email to
  android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com
  For more options, visit this group at
  http://groups.google.com/group/android-developers?hl=en
 



 --
 Mark Murphy (a Commons Guy)
 http://commonsware.com | http://github.com/commonsguy
 http://commonsware.com/blog | http://twitter.com/commonsguy

 Android App Developer Books: http://commonsware.com/books

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en


-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Wifi-connection

2010-10-01 Thread Irfan Sheriff
Look for the NetworkInfo object inside the NETWORK_STATE_CHANGED broadcast.
Get the detailed state
of the connection from the NetworkInfo using getDetailedState() which will
tell you whether the IP configuration
is complete.

See WifiSettings on how it is done.

On Fri, Oct 1, 2010 at 3:22 AM, Johannes De Smedt 
johannes.desm...@gmail.com wrote:

 Hi,

 I have an application in which I need to connect to an access point
 with a specific name. Therefor I start a scan
 (WifiManager.startScan()) and listen to BroadCastEvents of type
 SCAN_RESULTS_AVAILABLE_ACTION and NETWORK_STATE_CHANGED_ACTION.
 When the scan results are available, I check if my AP is found and if
 so I connect to it.

 When I'm connected to the AP, I receive a NETWORK_STATE_CHANGED_ACTION
 and there I open a SocketConnection to my serverSocket.
 The problem I'm having is that on the moment that I'm connected to the
 AP, the DHCP request is not yet finished. This causes the opening of
 the socketConnection to throw a SocketException: Network
 unreachable.
 A few moments later I see in the logcat logging: WifiStateTracker  -
 DhcpHandler: DHCP request succeeded.
 If I try to connect after this message, all goes fine.

 Now my question is: is there an event that I can listen to that
 informs me that the DHCP request is done?
 Now I try to create a connection and while an error occurs I retry.
 This is however very dangerous for hanging (if e.g the dhcp fails, the
 loop will never stop...)

 Any help?

 Thanks

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Parallel WiFi and Mobile Network Connections

2010-09-27 Thread Irfan Sheriff
On Sun, Sep 26, 2010 at 9:26 PM, yenpei yen...@gmail.com wrote:

 Are we able to establish both WiFi and 3G connections at the same time
 on Android 2.1?

No


 We are implementing a make-before-break, so that WiFi can be
 switched to 3G before tearing the WiFi connection down.


How are you planning to do this ?



 Please guide if you have come across this. Thanks.

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Re: wifi not remembering the access point

2010-09-22 Thread Irfan Sheriff
What does the output of $adb shell wpa_cli list_networks look like before
and after you restart wifi?

You could also try doing a $adb shell wpa_cli save_config after adding a
network and doing restart and see if it makes a difference.

On Wed, Sep 22, 2010 at 3:37 AM, kiran kiranbhat2...@gmail.com wrote:

 Hi All
 i am using ralink wifi driver in android, i am able to connect to
 the access-point using the Wireless Settings provided in the Android, But
 once i connect to the network and restart the wifi i have to reconnect
 manually by providing the authentication key. Wifi Manager is not
 remembering the last access point used . i am using the Settings application
 provided by the android.

 Regards
 Kiran

 --
 You received this message because you are subscribed to the Google Groups
 android-ndk group.
 To post to this group, send email to android-...@googlegroups.com.
 To unsubscribe from this group, send email to
 android-ndk+unsubscr...@googlegroups.comandroid-ndk%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/android-ndk?hl=en.


-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] WPA2-PEAPv0-MSCHAPv2 support in android.net.wifi package

2010-09-07 Thread Irfan Sheriff
Yeah, we do not expose the enterprise fields (eap  phase2 variables) in the
public API that allows a configuration like you mention.

There is no clear time frame to point, but hopefully we can expose these in
the next iteration.

Thanks

On Thu, Sep 2, 2010 at 8:04 AM, John_Spectross
john.johnnicho...@gmail.comwrote:

 Hi,

 I am planning to write a Wi-Fi connection manager for Android 2.1 
 2.2.

 It appears that the APIs available in android.net.wifi package
 doesn't provide an option to make WPA2-PEAPv0-MSCHAPv2 work.

 Is Android planning to release a patch to make WPA2-EAPs available in
 android.net.wifi? if so, when is it planned?

 Is it planned to be fixed in the next Android release? if so, when is
 it planned?

 Regds.
 John

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en