im currently writing an android app, which should keep track of other devices in the same wifi network using JmDNS. The discovery process works correctly, but i don't know how to keep track of other devices especially noticing their removing.
As mentioned in JmDNS device removal detection it seems like i have to implement this callback myself but I dont have any clue how to do this. It seems like the JmDNS Api doesn't provide any method to publish service messages myself.
My ideas so far:
- Use the discovered socket connection to keep track of changes
- Use JmDNS.requestServiceInfo() from time to time to check if the service is still available
- Un-/Register services + listeners so they can find each other again
Does anyone know another way to solve this issue or could tell me how to trigger the serviceRemoved()
callback?
PS: before taking this approach I tried Androids-NSD API, which seems to be quite unstable