diff --git a/src/platform/android/java/chip/platform/NsdServiceFinderAndResolver.java b/src/platform/android/java/chip/platform/NsdServiceFinderAndResolver.java index 743c1b97e19602..7ee8f979e5ac33 100644 --- a/src/platform/android/java/chip/platform/NsdServiceFinderAndResolver.java +++ b/src/platform/android/java/chip/platform/NsdServiceFinderAndResolver.java @@ -132,7 +132,12 @@ public void onResolveFailed(NsdServiceInfo serviceInfo, int errorCode) { "Failed to resolve service '" + serviceInfo.getServiceName() + "': " + errorCode); chipMdnsCallback.handleServiceResolve( serviceInfo.getServiceName(), - serviceInfo.getServiceType(), + // Use the target service info since the resolved service info sometimes appends a + // "." at the front likely because it is trying to strip the service name out of it + // and something is missed. + // The target service info service type should be effectively the same as the + // resolved service info. + NsdServiceFinderAndResolver.this.targetServiceInfo.getServiceType(), null, null, 0, @@ -157,11 +162,18 @@ public void onServiceResolved(NsdServiceInfo serviceInfo) { "Resolved service '" + serviceInfo.getServiceName() + "' to " - + serviceInfo.getHost()); + + serviceInfo.getHost() + + ", type : " + + serviceInfo.getServiceType()); // TODO: Find out if DNS-SD results for Android should contain interface ID chipMdnsCallback.handleServiceResolve( serviceInfo.getServiceName(), - serviceInfo.getServiceType(), + // Use the target service info since the resolved service info sometimes appends a + // "." at the front likely because it is trying to strip the service name out of it + // and something is missed. + // The target service info service type should be effectively the same as the + // resolved service info. + NsdServiceFinderAndResolver.this.targetServiceInfo.getServiceType(), serviceInfo.getHost().getHostName(), serviceInfo.getHost().getHostAddress(), serviceInfo.getPort(),