VNAPNIC / flutter_nearby_connections

Flutter plugin support peer-to-peer connectivity and the discovery of nearby devices for Android vs IOS
https://pub.dev/packages/flutter_nearby_connections
BSD 2-Clause "Simplified" License
109 stars 72 forks source link

Add new features and fix bugs on Android and iOS. #59

Open leechupe opened 5 months ago

leechupe commented 5 months ago

Bug: Android Side: Due to the Android framework version, some environment values have to be modified:

  1. Remove the package tag in AndroidManifest.xml.
  2. Set the service name to an absolute path in AndroidManifest.xml.
  3. Change the application name to the applicationName reference in AndroidManifest.xml.
  4. Upgrade com.android.tools.build:gradle version to 8.1.3
  5. Change the minSdkVersion to the flutter.minSdkVersion reference.

IOS Side:

  1. Add a _mp-connection._udp value to the field of the Bonjour service array in info.plist for fixing the NSNetServicesErrorCode = "-72008".

Flutter Side:

  1. Modify the serviceType from 'mpconn' to 'mp-connection' to address the problems IOS devices can't find.

New Features:

  1. Add a new feature for sending files.
  2. Add camera access requirement and the Image_picker lib for display file transfer feature.

Android Side:

  1. Add a new function to send a file by Payload.fromFile().

IOS Side:

  1. Add a new methodChannel and function to send a file by FlutterStandardTypedData type.
  2. Add the camera access requirement to the info.plist.

Flutter Side:

  1. Add a new button to the AlertDialog to send a file by the camera.
  2. Check whether the data is a file or string in the dataReceivedSubscription function.
leechupe commented 4 months ago

Dear All: I got a device-connected status problem when I used it on my project. I found the problem is that the devices didn't stop.
So I added a new methodChannel function named stop_all_endpoints for any needed situation stopping all endpoints. The original version only used it in the OnDestory function. I hope it will be helpful. Thank you.