Closed itssaklenkhan closed 1 year ago
Can you send your pubspec.yaml file? And how are you running discovery?
firstNearby(String uid) async { t = Timer.periodic(const Duration(seconds: 15), (t) async { if (val) { await Nearby().stopAdvertising(); await Future.delayed(const Duration(seconds: 1)) .whenComplete(() => discovery(uid));
// discovery(uid);
} else {
await Nearby().stopDiscovery();
await Future.delayed(const Duration(seconds: 1))
.whenComplete(() => advertising(uid));
// advtiger(uid);
}
val = !val;
});
}
discovery(
String uid,
) async {
try {
if (await chekBluetooth() &&
await chekLocation() &&
await chekBluetooth1() &&
await chekBluetooth2()) {
print('=====================discovery');
await Nearby().startDiscovery(
uid,
strategy,
onEndpointFound: (id, nearby, serviceId) {
print('======================>${nearby}');
// if (nearby.length > 20) {
updateUser(nearby: nearby, myuid: uid);
// }
},
onEndpointLost: (id) {
print('======================>${id}');
},
);
}
} catch (e) {
print('========e==============>${e}');
}
}
advertising(String myUid) async { if (await chekBluetooth() && await chekLocation()) { print('===============advtiger'); try { await Nearby().startAdvertising( myUid, strategy, onConnectionInitiated: (endpointId, connectionInfo) {}, onConnectionResult: (id, status) { print('======status================>${status}'); print('==========status============>${id}'); }, onDisconnected: (id) { print('======onDisconnected=====id===========>${id}'); }, ); } catch (exception) { print('======================>${exception.toString()}'); } } }
cupertino_icons: ^1.0.2 http: ^0.13.5 provider: ^6.0.5 shared_preferences: ^2.0.17 flutter_screenutil: ^5.6.1 image_picker: ^0.8.6 firebase_core: ^2.5.0 firebase_auth: ^4.2.6 intl: ^0.17.0 cloud_firestore: ^4.3.2 firebase_storage: ^11.0.11 uuid: ^3.0.7 connectivity: ^3.0.6 permission_handler: ^10.2.0 firebase_messaging: ^14.2.4 flutter_local_notifications: ^13.0.0 nearby_connections: ^3.2.0
I think these are just logs which you can ignore there are internal to nearby connections android
Is any exceptions being raised on flutter end? what is the exact issue? because I see that onEndpointFound is still called which means that everything is running fine.
@itssaklenkhan
sir if have you time plz update ios PLATFORM
You can consider using this package for iOS support: https://pub.dev/packages/flutter_nearby_connections
Closing this now, since this is just a debug log printed by android nearby connections library
https://pub.dev/packages/flutter_nearby_connections this is not support android and ios
flutter_local_notifications: ^13.0.0 that is why not support nearby_connections: ^3.2.0
I/flutter (17835): =============Discovery========= D/NearbyConnections(17835): NFC discovery started. D/NearbyConnections(17835): Invalidating dispatch state. D/NearbyConnections(17835): Starting NFC dispatching. D/NearbyConnections(17835): Cannot dispatch NFC events. NFC is not supported. D/nearby_connections(17835): startDiscovery D/nearby_connections(17835): onEndpointFound D/nearby_connections(17835): onEndpointFound