Android 附近连接:无法将有效负载发送到多个设备

Android 附近连接:无法将有效负载发送到多个设备,android,android-bluetooth,google-nearby,Android,Android Bluetooth,Google Nearby,我无法创建一个群组聊天,在这个群组聊天中,附近有2个(最多15个)以上的android用户可以加入聊天室 startMeshNetwork()开始公布连接和发现。 这在onCreate()中调用,也在成功连接的回调中调用。这样,设备将继续加入附近的所有设备 public void startMeshNetwork(){ Nearby.getConnectionsClient(this) .startAdvertising(

我无法创建一个群组聊天,在这个群组聊天中,附近有2个(最多15个)以上的android用户可以加入聊天室

startMeshNetwork()
开始公布连接和发现。 这在
onCreate()
中调用,也在成功连接的回调中调用。这样,设备将继续加入附近的所有设备

public void startMeshNetwork(){
    Nearby.getConnectionsClient(this)
            .startAdvertising(
                    /* endpointName= */ "Name here",
                    /* serviceId= */ "ID here",
                    mConnectionLifecycleCallback,
                    new AdvertisingOptions(com.google.android.gms.nearby.connection.Strategy.P2P_CLUSTER));

    Nearby.getConnectionsClient(this)
            .startDiscovery(
                    /* serviceId= */ "ID here",
                    new EndpointDiscoveryCallback() {
                        @Override
                        public void onEndpointFound(String endpointId, DiscoveredEndpointInfo info) {                       Nearby.getConnectionsClient(getApplicationContext())
                                    .requestConnection(
                                            /* endpointName= */ "Name here",
                                            endpointId,
                                            mConnectionLifecycleCallback);
                            endpoints.add(endpointId);
                        }

                        @Override
                        public void onEndpointLost(String endpointId) {
                            startMeshNetwork();
                        }
                    },
                    new DiscoveryOptions(com.google.android.gms.nearby.connection.Strategy.P2P_CLUSTER));

}
向所有连接的设备发送有效载荷的代码段

Payload payload = Payload.fromBytes(pendingmessage.getBytes());
for(String endpointId:endpoints)
            Nearby.getConnectionsClient(getApplicationContext()).sendPayload(endpointId, payload);

正在使用此方法建立连接,但是,有效负载发送不一致,并且只发送到一个设备。

我可能对此有错误,但您使用STAR和群集策略而不使用STAR和群集策略有什么原因吗?谢谢您指出这一点。虽然我不认为这是问题的根源。我一定会改变的。