Android & iOS dns-sd: how to make opening a service cross-platform?

On Android, I do this to create a broadcast service using a simple linked map as information

HashMap<String, String> record = new HashMap<>(); record.put("info, "my android info"); WifiP2pDnsSdServiceInfo serviceInfo = WifiP2pDnsSdServiceInfo .newInstance("_myservice", "_tcp", record); WifiP2pManager manager = (WifiP2pManager) getSystemService(Context.WIFI_P2P_SERVICE); Channel channel = manager.initialize(this, this.getMainLooper(), null); manager.addLocalService(channel, serviceInfo, null); 

to get another signal

 manager.setDnsSdResponseListeners(channel, this, this); @Override public void onDnsSdTxtRecordAvailable(String fullDomainName, Map<String, String> txtRecordMap, WifiP2pDevice srcDevice) 

On iOS, this is the same service name and information map

 MCPeerID* _myPeerId=[[MCPeerID alloc] initWithDisplayName:@"my ios peer"]; NSDictionary* _serviceInfo=@ {@"info": @"my ios info"}; MCNearbyServiceAdvertiser* _serviceAdvertiser = [[MCNearbyServiceAdvertiser alloc] initWithPeer:_myPeerId discoveryInfo:_serviceInfo serviceType:@"myservice"]; _serviceAdvertiser.delegate=advertiseDelegate; MCNearbyServiceBrowser* _serviceBrowser=[[MCNearbyServiceBrowser alloc] initWithPeer:_myPeerId serviceType:@"myservice"]; _serviceBrowser.delegate=browserDelegate; [_serviceAdvertiser startAdvertisingPeer]; [_serviceBrowser startBrowsingForPeers]; 

and delegates

 -(void)browser:(MCNearbyServiceBrowser *)browser lostPeer:(MCPeerID *)peerID -(void)browser:(MCNearbyServiceBrowser *)browser foundPeer:(MCPeerID *)peerID withDiscoveryInfo:(NSDictionary<NSString *,NSString *> *)info 

An Android device can only see another Android device, as well as iOS devices. However, two families cannot see each other. I would like them to see other devices, regardless of the operating system.

+7
android ios bonjour dns-sd multipeer-connectivity
source share

No one has answered this question yet.

See similar questions:

eighteen
Is Android NSD (Network Service Discovery) compatible with Bonjour on iOS?

or similar:

3606
Close / hide Android soft keyboard
3295
Why is the Android emulator so slow? How can we speed up Android emulator development?
3288
Correct use cases for Android UserManager.isUserAGoat ()?
2609
Is there a unique identifier for an Android device?
2510
How to keep Android activity state by saving instance state?
2284
How can I fix the 'android.os.NetworkOnMainThreadException'?
2097
Is there a way to run Python on Android?
1858
"Debug certificate expired" error in Android Eclipse plugins
1844
What is "Context" on Android?
890
How to check if the service is running on Android?

All Articles