问题
Is there a way to uniquely identify a discovered endpoint and persist that information over reconnection? Apparently the endpointId changes after a disconnection. If I correctly recall, in the former api there was a persistent identifier.
回答1:
Nearby Connections doesn't support reconnections yet, but you can encode a persistent id in your endpoint name (eg. endpointName="1234:Will").
Please note that the endpoint name can be spoofed, so if you need a secure connection you need to either compare the auth token or do some more authentication after accepting the connection.
来源:https://stackoverflow.com/questions/47369402/nearby-connection-2-0-identify-endpoint-over-reconnection