startDiscovery method
Future<bool>
startDiscovery(
- String userNickName,
- Strategy strategy, {
- required OnEndpointFound onEndpointFound,
- required OnEndpointLost onEndpointLost,
- String serviceId = "com.pkmnapps.nearby_connections",
Start Discovery, You will now be able to discover the advertisers now.
serviceId
is a unique identifier for your app, its recommended to use your app package name only, it cannot be null
userNickName
and strategy
should not be null
Implementation
Future<bool> startDiscovery(
String userNickName,
Strategy strategy, {
required OnEndpointFound onEndpointFound,
required OnEndpointLost onEndpointLost,
String serviceId = "com.pkmnapps.nearby_connections",
}) async {
_onEndpointFound = onEndpointFound;
_onEndpointLost = onEndpointLost;
return await _channel.invokeMethod('startDiscovery', <String, dynamic>{
'userNickName': userNickName,
'strategy': strategy.index,
'serviceId': serviceId,
}) ??
false;
}