Sign in to follow this  
Naash

Android WiFi Direct issues

Recommended Posts

Naash    104

Hi

    I am working on a multiplayer game which involves connectivity using WiFi Direct. So I have come across an issue.

From my game if device 'A' sends request to device 'B' and device 'B' declines it, then device 'A' cannot send another request to device 'B' . Why is this happening and what all should I keep in mind to prevent this ?

Thanks in advance :)

Share this post


Link to post
Share on other sites
hplus0603    11356
Presumably the other end already caches the fact that the request was declined, to avoid having to decline a flood of persistent requests.
I think the only thing you can do is not decline the request, or wait until some kind of time-out.
You should make sure to cancel/destroy any previous invitations.
Perhaps turn WiFi off and on again on both devices might reset the decline-cache?

Note that the core WiFi code doesn't know what to do when the invitation is declined; check out the comment on line 1707:
https://android.googlesource.com/platform/frameworks/base/+/b267554/wifi/java/android/net/wifi/p2p/WifiP2pService.java

Overall, I think WiFi Direct is not a great technology. It might help with connectivity when two people want to share pictures and are in the middle of the jungle with no access point or cell phone tower nearby, but otherwise, using regular IP networking over regular WiFi is much better.

Share this post


Link to post
Share on other sites
C0lumbo    4411

Overall, I think WiFi Direct is not a great technology. It might help with connectivity when two people want to share pictures and are in the middle of the jungle with no access point or cell phone tower nearby, but otherwise, using regular IP networking over regular WiFi is much better.

I wish Android would do some equivalent of iOS's multipeer and bundle all their direct device-to-device technologies under one comms layer agnostic API. I don't really want to have to write code to support bluetooth, WiFi Direct and WiFi Aware (new for Android O - https://developer.android.com/preview/features/wifi-aware.html) just for some 1 vs 1 multiplayer to accomodate a minority of users who want to play when there's no router around.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this