Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues with Flutter (Android) -> Native Android (Kotlin/Java) nearby connection. #32

Open
reducedcarpet opened this issue Jan 6, 2022 · 0 comments

Comments

@reducedcarpet
Copy link

Hey, I was trying to get a new flutter app to connect to an old / already made Android Native app written in Kotlin/Java, with the Kotlin side as the advertiser. But I couldn't get them to connect until I examined the code.

Setting the Service Name on the Kotlin side to "flutter_nearby_connections" made it connect, probably due to that name being hard wired into the Android plugin in Flutter Nearby Connections. ( const val SERVICE_ID = "flutter_nearby_connections" )

So the Native code became:

Nearby.getConnectionsClient(this).startAdvertising(
                    deviceShortInfoString,
                    "flutter_nearby_connections",
                    connectionLifecycleCallback,
                    advertisingOptions)

For a good while I tried to change the serviceType on the flutter side to be exactly the same as the advertiser service name but obviously that didn't work. Is that only for iOS?

So my question is: Would it be possible to pass in a custom string into the flutter code to set the service name to something other than flutter_nearby_connections? That would make it a lot easier to work with legacy code from android native, especially if you don't want cross-talk between two different nearby sessions. Which is something we have wanted in the past.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant