Why is discovering peers for Android Wi-Fi Direct so unreliable?

前端 未结 4 592
礼貌的吻别
礼貌的吻别 2020-12-25 10:24

I am experimenting with Android\'s Wi-Fi Direct (or P2P if you prefer). I thought it was working very nicely between my two phones, but I realized I am encountering issues w

4条回答
  •  时光取名叫无心
    2020-12-25 10:53

    I had a really big problem with establishing connection between devices:

    • first device turns on peer discovery
    • second device turns on peer discovery
    • one device tries to establish connection with the second one
    • sometimes it works, sometimes not (I would say 50/50)

    I guess the issue was the group owner negotiation (I've tried change groupOwnerIntent param also to force who should be group owner, but it didn't helped).

    So, what did I do?

    I change flow to:

    • one device creates group (mManager.createGroup(...)), so this device is always a group owner
    • second devices connects with group owner
    • whooala, now is very rare to stuck on invited state.

提交回复
热议问题