What is the character limit of username in Nearby Connection Api?

22 Views Asked by At

Hey I am developing a file sharing application where I send a Advertiser full information as Map to other user which is something this

    _advertiser = Advertiser(
            name: userModel.name != null ? userModel.name! : userModel.mobileModel,
            mobileName: userModel.mobileModel,
            image: "https://images.pexels.com/photos/1104007/pexels-photo-1104007.jpeg?cs=srgb&dl=pexels-luna-lovegood-1104007.jpg&fm=jpg&_gl=1*ayvg9x*_ga*MjA2NDcwMTg1Ny4xNjg4ODQ1NjYw*_ga_8JE65Q40S6*MTY4OTc2MjQ1OC4yLjEuMTY4OTc2MjQ1OC4wLjAuMA..",
            imageType: "asset",
            allow: mode,
            password: mode == "everyOne" ? "" : "12345"
        );

String advertiserInfo = jsonEncode(_advertiser!.toJson());

here is how I pass value to advertiser

await Nearby().startAdvertising(
        advertiserInfo, /// this is the user information for advertiser role
        strategy,
        onConnectionInitiated: onConnectionInit,
        onConnectionResult: (id, status) {

        },
        onDisconnected: (id) {
        },
      );

where in the receiver or discovery side I get this output

debugPrint("${id}/////////////////${name}",wrapWidth: 1024);

    0UA7/////////////////{"name":"Infinix X683","mobile":"Infinix X683","image":"https://images.pexels.com/photos/1104007/pexels-photo-1104007.jpeg?cs=srgb&

using this code

await Nearby().startDiscovery(
        userName!,
        strategy,
        onEndpointFound: (id, name, serviceId) {
          debugPrint("${id}/////////////////${name}",wrapWidth: 1024);
         _advertiser = Advertiser.fromJson(jsonDecode(name));
            endPointName = _advertiser!.name!.isNotEmpty ? _advertiser!.name! : _advertiser!.mobileName!;
            notifyListeners();
        },
        onEndpointLost: (id) {
        },
      );

but if I pass low parameters like this

   _advertiser = Advertiser(
        name: userModel.name != null ? userModel.name! : userModel.mobileModel,
        mobileName: userModel.mobileModel,
        image: "person.png",
        imageType: "asset",
        allow: mode,
        password: mode == "everyOne" ? "" : "12345"
    );

so I get no issue

32VG/////////////////{"name":"Waqas","mobile":"ONEPLUS A6000","image":"person.png","imageType":"asset","allow":"everyOne","password":""}

why this problem occur does there is a certain limit due to which I am not getting full map as String and I am using this package in flutter "https://pub.dev/packages/nearby_connections" which is using Google nearby Connection API in android side

0

There are 0 best solutions below