Re: WiFi Direct questions

9,195 views
Skip to first unread message

Mohmad Ra

unread,
Jun 14, 2013, 3:17:55 PM6/14/13
to android-...@googlegroups.com, ishe...@gmail.com
Is there a call back for the situation when the GO declines the connection request from a guest?

On Thursday, July 19, 2012 10:52:31 AM UTC-5, Irfan Sheriff wrote:
We do have some service discovery extensions to the demo app that will go as part of the training tutorials on the developer site.

There is also service discovery code as part of CtsVerifier app

On Thu, Jul 19, 2012 at 1:26 AM, kh <android....@gmail.com> wrote:
Hi,

Android 4.1 supports service discovery and to register service.
But the APIs are not clear to me. Please clarify. Is there any example code like Wifidemo in the previous Android versions ?

public void addLocalService (WifiP2pManager.Channel c, WifiP2pServiceInfo servInfo, WifiP2pManager.ActionListener listener)

==> not clear how to set servInfo variable.

public void addServiceRequest (WifiP2pManager.Channel c, WifiP2pServiceRequest req, WifiP2pManager.ActionListener listener)

===> WifP2pServiceRequest talks about "String queryData". How do we use this in conjunction with addLocalService ?

An example code for service discovery and service advertisement will help. I was looking for vendor specific service.
thanks.





On Sunday, February 12, 2012 3:20:16 PM UTC+9, Irfan Sheriff wrote:


On Tue, Jan 31, 2012 at 3:51 PM, Prem Kumar <prem...@gmail.com> wrote:
Hi,

I have the WFD demo program working with a couple retail Galaxy
Nexus's running 4.0.2. I started playing around with a few new API's
and have a few basic questions at the end of this mail.

I created a group owner using WifiP2pManager.createGroup(). After the
group was successfully created, I requested for group info using
requestGroupInfo(channel, groupInfoListener). After the
GroupInfoListener method onGroupInfoAvailable(WifiP2pGroup group) was
called, I printed out all the group and device info per the source
code below:

private class WfDGroupInfoListener implements GroupInfoListener {

 @Override
 public void onGroupInfoAvailable(WifiP2pGroup group) {
   if (group != null) {
     Log.d(TAG, "-----Group Info-----");
     Log.d(TAG, "SSID: " + group.getNetworkName());
     Log.d(TAG, "Address: " + group.getInterface());
     Log.d(TAG, "Passphrase: " + group.getPassphrase());

     WifiP2pDevice p2pDevice = group.getOwner();
     Log.d(TAG, "serviceDiscoveryCapable: " +
((p2pDevice.isServiceDiscoveryCapable()) ? true : false));
     Log.d(TAG, "wpsDisplaySupported: " +
((p2pDevice.wpsDisplaySupported()) ? true : false));
     Log.d(TAG, "wpsKeypadSupported: " +
((p2pDevice.wpsKeypadSupported()) ? true : false));
     Log.d(TAG, "wpsPbcSupported: " +
((p2pDevice.wpsPbcSupported()) ? true : false));
   } else {
       Log.d(TAG, "group is NULL");
   }
 }
}

My debug log contains:

01-30 15:59:37.879: D/WfdTest(1913): -----Group Info-----
01-30 15:59:37.879: D/WfdTest(1913): SSID: "DIRECT-fd"
01-30 15:59:37.879: D/WfdTest(1913): Address: p2p-wlan0-0
01-30 15:59:37.879: D/WfdTest(1913): Passphrase: "KhHm7U0w"
01-30 15:59:37.879: D/WfdTest(1913): serviceDiscoveryCapable: false
01-30 15:59:37.879: D/WfdTest(1913): wpsDisplaySupported: false
01-30 15:59:37.879: D/WfdTest(1913): wpsKeypadSupported: false
01-30 15:59:37.879: D/WfdTest(1913): wpsPbcSupported: false

My basic questions are:

1. Why do all the WPS and Service Discovery options return false?

2. How can service discovery be initiated by an application? The
Android WFD API doc has a vague mention of "Android has no platform
support for service discovery yet, so applications could run a service
discovery protocol to discover services on the peer-to-peer
network.".  The Wifi P2P spec allows for (optional) Service Discovery
using GAS frames but not sure how they can be initiated using the SDK
prior to getting an IP?

3. How can a specific WPS configuration like PIN or PBC be configured
for the group owner (acting as a  standalone registrar)?
 
Pre-association service discovery is not supported yet. As for WPS settings on
the GO, it should support all forms and there is no way to restrict it to be PIN or 
PBC alone.


4. How can a WFD client/enrollee be configured to use PIN or PBC to
connect to the GO?

The WifiP2pManager connect() API accepts a WifiP2pConfig which allows you to specify WPS

5. Is there a way to force the GO to be on a specific Wifi Channel
(P2P spec v1.1 section 3.1.4.2.1 allows for a  "preferred Operating
Channel"?

Not supported yet
 

6. Is there a way to chose a specific SSID (P2P spec v1.2 section
3.2.1 says "Any byte values allowed for an SSID according to
IEEE802.11-2007 [1] may be included after the string --DIRECT-xy||
(including none)")?

No
 

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


--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To view this discussion on the web visit https://groups.google.com/d/msg/android-platform/-/G-8wk8YHBzoJ.

To post to this group, send email to android-...@googlegroups.com.
To unsubscribe from this group, send email to android-platfo...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/android-platform?hl=en.

Saee Bhosale

unread,
Aug 2, 2013, 5:59:35 AM8/2/13
to android-...@googlegroups.com
Did you find a way to connect devices without the pop up? I need to connect two devices without user interaction and verify the passkey.

On Tuesday, June 19, 2012 7:10:39 AM UTC+5:30, kh wrote:
Hi,

I have a similar question.

When two devices try to connect through Wi Fi, we get a popup with Accept/Decline.

Is it possible to remove this pop up so that the 2 devices connect automatically ?

thanks.

user123

unread,
Oct 3, 2013, 2:00:43 PM10/3/13
to android-...@googlegroups.com
I'm also looking for a way to connect devices without a popup. In my case it's important since I want to connect a lot of users with 1 "host" at the same time. The host can't click 10+ dialogs each session...

Prem Kumar

unread,
Jan 31, 2012, 6:51:00 PM1/31/12
to android-platform
4. How can a WFD client/enrollee be configured to use PIN or PBC to
connect to the GO?

5. Is there a way to force the GO to be on a specific Wifi Channel
(P2P spec v1.1 section 3.1.4.2.1 allows for a "preferred Operating
Channel"?

Prem Kumar

unread,
Feb 3, 2012, 12:54:19 PM2/3/12
to android-platform
Hi,

Just wanted to check back in to see if anyone has any insights to my
questions?

Regards,
Prem

Irfan Sheriff

unread,
Feb 12, 2012, 1:20:16 AM2/12/12
to android-...@googlegroups.com
On Tue, Jan 31, 2012 at 3:51 PM, Prem Kumar <prem...@gmail.com> wrote:
Pre-association service discovery is not supported yet. As for WPS settings on
the GO, it should support all forms and there is no way to restrict it to be PIN or 
PBC alone.

4. How can a WFD client/enrollee be configured to use PIN or PBC to
connect to the GO?
The WifiP2pManager connect() API accepts a WifiP2pConfig which allows you to specify WPS

5. Is there a way to force the GO to be on a specific Wifi Channel
(P2P spec v1.1 section 3.1.4.2.1 allows for a  "preferred Operating
Channel"?

Not supported yet
 

6. Is there a way to chose a specific SSID (P2P spec v1.2 section
3.2.1 says "Any byte values allowed for an SSID according to
IEEE802.11-2007 [1] may be included after the string --DIRECT-xy||
(including none)")?

deepthi gowri

unread,
Feb 12, 2012, 2:42:28 AM2/12/12
to android-...@googlegroups.com

>>>> you can set Specific operating/listen channel in p2p conf file

for eg:

p2p_listen_reg_class=81
p2p_listen_channel=1
p2p_oper_reg_class=81
p2p_oper_channel=1
 

6. Is there a way to chose a specific SSID (P2P spec v1.2 section
3.2.1 says "Any byte values allowed for an SSID according to
IEEE802.11-2007 [1] may be included after the string --DIRECT-xy||
(including none)")?

No

>>>> This is currently not supported in ics but you can use p2p_set ssid_postfix  postfix(as you like) from cli or you can use same command in ics too.

Thanks,
Deepthi. 

Prem Kumar

unread,
Feb 22, 2012, 6:34:32 PM2/22/12
to android-...@googlegroups.com
Thanks for your response. I have a little feedback and a few more questions.

1. If pre-assoc service discovery is not supported, it is very disruptive to force WPS assoc/IP generation prior to deciding who to connect to. What are the plans to fix this and time frame?

2. You mention that all WPS methods are supported. However, the usability (from an end-user perspective) is poor and in some cases, it is also very unclear how to use the SDK API's. Here are some observations (based on modifying the sample WFD demo app WPS config object):

Experiment 1:
p2pconfig.wps.setup = WpsInfo.DISPLAY;
p2pconfig.wps.pin = "0000";
On connect, PIN is displayed on local device and requests user to enter same PIN on remote device; once PIN is entered, connect completes successfully.
Summary: Works but very cumbersome to have a popup on local device and to enter an 8 digit PIN. Is there a programmatic way to set/share PIN info?

Experiment 2:
p2pconfig.wps.setup = WpsInfo.KEYPAD;
p2pconfig.wps.pin = "0000";
On connect, asks user for PIN on remote device. not clear what should be entered and how PIN should be configured on local device. Entering 0000 on remote device does not work.
Summary: Not clear how PIN should be configured and what should be entered on remote device?

Experiment 3:
p2pconfig.wps.setup = WpsInfo.LABEL;
p2pconfig.wps.pin = "0000";
On connect, asks user for PIN on remote device. Entering 0000 on remote device works
However if wrong PIN is entered, can't reconnect again at all!! On failed device, peer discovery stops as well.
Summary: Works but not clear if there is soft way to pre-program the PIN so the user does not have to manually enter it since the pop-up is annoying for co-operating applications and esp since service discovery does not work.

Experiment 4:
config.wps.setup = WpsInfo.LABEL;
asks if MAC address can connect; On OK, connect completes successfully
On connect, asks user to validate MAC address on remote device. Entering OK works.
Summary: Simplest configuration method but confusing since user has no notion of MAC addresses and whether something is valid or not. Also not clear how one can avoid a popup requesting the user to validate a confusing MAC address esp if the application has other (better) ways of discovery/auth.

Other observations:
  • It is extremely easy to crash the phone (not just application) on the device that is asked to connect after a failed connect.
  • It is extremely easy to crash phone (not just application) after a few WFD enable/disables and running the WFD demo a few times.
Any input on any of the above points will be very helpful.

Thanks,
Prem

Prem Kumar

unread,
Feb 22, 2012, 6:36:47 PM2/22/12
to android-...@googlegroups.com
Thanks for your response. 

How is one supposed to access the p2p commands and/or conf file from the SDK? I can't get to them using the adb shell either (on a retail galaxy nexus).

Thanks,
Prem

Prem Kumar

unread,
Feb 22, 2012, 7:29:45 PM2/22/12
to android-...@googlegroups.com
Sorry, a mistake in Experiment 4. It should read as p2pconfig.wps.setup = WpsInfo.PBC;

AAT

unread,
Feb 23, 2012, 6:40:41 AM2/23/12
to android-platform
See if this link helps you out:
http://processors.wiki.ti.com/index.php/OMAP_Wireless_Connectivity_NLCP_WiFi_Direct_Configuration_Scripts

On 22 fev, 21:36, Prem Kumar <premk...@gmail.com> wrote:
> Thanks for your response.
>
> How is one supposed to access the p2p commands and/or conf file from the
> SDK? I can't get to them using the adb shell either (on a retail galaxy
> nexus).
>
> Thanks,
> Prem
>
> On Sat, Feb 11, 2012 at 11:42 PM, deepthi gowri <deepthi.go...@gmail.com>wrote:
>
>
>
>
>
>
>
>
>
> > On Sun, Feb 12, 2012 at 11:50 AM, Irfan Sheriff <isher...@gmail.com>wrote:

Prem Kumar

unread,
Feb 23, 2012, 2:02:46 PM2/23/12
to android-...@googlegroups.com
Thanks very much for the link. It is definitely helpful, but:

1. There appears to be no wpa_cli on my retail galaxy nexus (verizon version)
$ adb shell
shell@android:/ $ wpa_cli
wpa_cli
/system/bin/sh: wpa_cli: not found

2. The SDK does not expose a lot of the underlying capabilities of the p2p protocol/driver which makes WFD/p2p very difficult (impossible?) to use for an android market app.

Olafur

unread,
Mar 29, 2012, 11:00:40 AM3/29/12
to android-...@googlegroups.com
I too have been playing around with the WiFi direct API and my experience is similar to yours. I can only agree that the framework is unstable and clearly not product ready: device stops discovering neighbours, WiFi direct goes off and cannot be turned on again (reboot required), WiFi direct hangs in the ‘connecting’ state.

My results for experiment 3 are not the same as yours (WpsInfo.LABEL connection setup method).  For this case, the local device hangs in the connecting state and nothing happens at the remote device (no pop-up dialog - nothing).  The API documentation for the connection methods is poor.  How does one configure the PIN that clients use in a WpsInfo.LABEL connection setup?  I cannot find any configuration options for WiFi direct to do this.
To post to this group, send email to android-platform@googlegroups.com.
To unsubscribe from this group, send email to android-platform+unsubscribe@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/android-platform?hl=en.


--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To post to this group, send email to android-platform@googlegroups.com.
To unsubscribe from this group, send email to android-platform+unsubscribe@googlegroups.com.
To post to this group, send email to android-platform@googlegroups.com.
To unsubscribe from this group, send email to android-platform+unsubscribe@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/android-platform?hl=en.


--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To post to this group, send email to android-platform@googlegroups.com.
To unsubscribe from this group, send email to android-platform+unsubscribe@googlegroups.com.
To post to this group, send email to android-platform@googlegroups.com.
To unsubscribe from this group, send email to android-platform+unsubscribe@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/android-platform?hl=en.


--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To post to this group, send email to android-platform@googlegroups.com.
To unsubscribe from this group, send email to android-platform+unsubscribe@googlegroups.com.
To post to this group, send email to android-platform@googlegroups.com.
To unsubscribe from this group, send email to android-platform+unsubscribe@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/android-platform?hl=en.


--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To post to this group, send email to android-platform@googlegroups.com.
To unsubscribe from this group, send email to android-platform+unsubscribe@googlegroups.com.

Dirk Jäckel

unread,
Mar 30, 2012, 6:15:45 AM3/30/12
to android-...@googlegroups.com
Hi!

I also have been playing with wifi direct but it crashed my phone
really often so I stopped trying. It crashed the Galaxy Nexus with
4.0.1, 4.0.2 and AOSP 4.0.3.

Were there changes in 4.0.4? Should I try again with 4.0.4?

Regards,
Dirk

Narseo Vallina Rodriguez

unread,
Mar 31, 2012, 6:16:37 PM3/31/12
to android-...@googlegroups.com
Same here with two Galaxy S. I tried the WiFi direct demo and it is
crashing in different phases but mainly in connect phase

> --
> You received this message because you are subscribed to the Google Groups "android-platform" group.

> To post to this group, send email to android-...@googlegroups.com.
> To unsubscribe from this group, send email to android-platfo...@googlegroups.com.


> For more options, visit this group at http://groups.google.com/group/android-platform?hl=en.
>

--
Narseo

Irfan Sheriff

unread,
Jun 19, 2012, 12:53:24 PM6/19/12
to android-...@googlegroups.com
No

On Mon, Jun 18, 2012 at 6:40 PM, kh <android....@gmail.com> wrote:
Hi,

I have a similar question.

When two devices try to connect through Wi Fi, we get a popup with Accept/Decline.

Is it possible to remove this pop up so that the 2 devices connect automatically ?

thanks.

--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To view this discussion on the web visit https://groups.google.com/d/msg/android-platform/-/ECBT0pXHmEkJ.

kh

unread,
Jul 19, 2012, 4:26:10 AM7/19/12
to android-...@googlegroups.com
Hi,

Android 4.1 supports service discovery and to register service.
But the APIs are not clear to me. Please clarify. Is there any example code like Wifidemo in the previous Android versions ?

public void addLocalService (WifiP2pManager.Channel c, WifiP2pServiceInfo servInfo, WifiP2pManager.ActionListener listener)

==> not clear how to set servInfo variable.

public void addServiceRequest (WifiP2pManager.Channel c, WifiP2pServiceRequest req, WifiP2pManager.ActionListener listener)

===> WifP2pServiceRequest talks about "String queryData". How do we use this in conjunction with addLocalService ?

An example code for service discovery and service advertisement will help. I was looking for vendor specific service.
thanks.





On Sunday, February 12, 2012 3:20:16 PM UTC+9, Irfan Sheriff wrote:
To post to this group, send email to android-platform@googlegroups.com.
To unsubscribe from this group, send email to android-platform+unsubscribe@googlegroups.com.

Irfan Sheriff

unread,
Jul 19, 2012, 11:52:31 AM7/19/12
to android-...@googlegroups.com
We do have some service discovery extensions to the demo app that will go as part of the training tutorials on the developer site.

There is also service discovery code as part of CtsVerifier app

On Thu, Jul 19, 2012 at 1:26 AM, kh <android....@gmail.com> wrote:
To view this discussion on the web visit https://groups.google.com/d/msg/android-platform/-/G-8wk8YHBzoJ.

To post to this group, send email to android-...@googlegroups.com.
To unsubscribe from this group, send email to android-platfo...@googlegroups.com.

kh

unread,
Jul 19, 2012, 9:11:13 PM7/19/12
to android-...@googlegroups.com
CTS doesn't seem to have for 4.1 in this link http://source.android.com/compatibility/downloads.html
When would the demo extension and CTS be available ? thanks.

kh

unread,
Jul 20, 2012, 4:22:41 AM7/20/12
to android-...@googlegroups.com
The other question I had is: is it possible to back port wifi direct service discovery/registration to ICS ? If not possible, why ? are there any dependencies with lower layers ? thanks.

kh

unread,
Sep 3, 2012, 1:59:41 AM9/3/12
to android-...@googlegroups.com
Hi,

I see that service related APIs is dimmed in the Android API page. What does this mean ?
Ref: http://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.html
thanks.

kh

unread,
Sep 6, 2012, 10:25:00 PM9/6/12
to android-...@googlegroups.com
Hi,

How do we register a vendor specific service in 4.1 ?
More specifically how do we use WifiP2pServiceInfo ? And how or where do I use SERVICE_TYPE_VENDOR_SPECIFIC ?
When I try to instantiate a variable of type WifiP2pServiceInfo, it gives error:
"The constructor WifiP2pServiceInfo() is undefined"
Looks like the documentation available for this is incomplete:
http://developer.android.com/reference/android/net/wifi/p2p/nsd/WifiP2pServiceInfo.html
It doesn't talk about any constructors.

Android team: Please update the documentation on using the classes for services or please share a demo program.

thanks.

kh

unread,
Oct 11, 2012, 10:01:33 PM10/11/12
to android-...@googlegroups.com
hi,

How can we view/log wifi frames in an Android device /

thank you.

juan felipe perez ramirez

unread,
Oct 1, 2015, 1:16:10 PM10/1/15
to android-platform
Hello,

I am working on wifi direct and so far I am having some problems. I am using Nexus 7 tablets (android 5.0.2) and Samsung Galaxy s3 (android 4.4.2 & 4.3). When two devices create a group (one is a GO and the other the Client), sometimes the group gets disconnected. Doing some research in the Log, when this happens the Gorup owner usually shows P2P-GROUP-REMOVED GO reason =  REQUESTED and the client P2P-GROUP-REMOVED client reason= IDLE or GO_ENDING_SESSION. Does this behavior have something to do with what is happening with the Wifi connection establish with any AP?.

ASHISH KUMAR Dhanotiya

unread,
Jun 20, 2016, 4:33:28 PM6/20/16
to android-platform, prem...@gmail.com
Hi I am having the same issue :

I am trying to develop an app which connects two android devices using wi-fi direct. I am referring the sample project in the Android SDK 17 called "WiFiDirectDemo". It establishes a Wi-Fi Direct connection but it does not have PIN authentication.

I don't know how to configure the config.wps.setup in the class DeviceDetailFragment.

How can I find out the connection request on the other device, is there any callback for that ?

I tried adding following lines in the demo code (inside DeviceDetailFragment.java file) but still it connects without showing any dialog : Do i need to modify any thing else apart from these two line ?

config.wps.setup = WpsInfo.DISPLAY; config.wps.pin = "0000";

or

config.wps.setup = WpsInfo.KEYPAD; config.wps.pin = "0000";

Thanks for any leads.

Brendan Kirby

unread,
Jul 6, 2016, 12:33:49 PM7/6/16
to android-platform, prem...@gmail.com
This is what I do:

/**
 * Initiates a connection to a service
 * @param service The service to connect to
 */

public void initiateConnectToService(DnsSdService service) {
 
// Device info of peer to connect to
 
WifiP2pConfig wifiP2pConfig = new WifiP2pConfig();
 wifiP2pConfig
.deviceAddress = service.getSrcDevice().deviceAddress;
 wifiP2pConfig
.wps.setup = WpsInfo.PBC;

 
// Starts a peer-to-peer connection with a device with the specified configuration
 wifiP2pManager
.connect(channel, wifiP2pConfig, new WifiP2pManager.ActionListener() {
 
// The ActionListener only notifies that initiation of connection has succeeded or failed

 
@Override
 
public void onSuccess() {
 
Log.i(TAG, "Initiating connection to service");
 
}

 
@Override
 
public void onFailure(int reason) {
 
Log.e(TAG, "Failure initiating connection to service: " + FailureReason.fromInteger(reason).toString());
 
}
 
});
}

Reply all
Reply to author
Forward
0 new messages