Android NSDManager not detecting services after a while

I recently started working on network service discovery that is provided by Android.

I made a sample based on "NSDChat". The purpose of this sample is to install it on two devices such as "Provider" and the other as "Receiver". The provider will register once and will search for devices that are registered by "discovery" and will connect and send data to an authorized device on their network. And from the Receiver it will simply register and wait for the providers' connection to receive data. The sample works fine, which means that whenever I run the app on two devices, the provider and recipients are registered, and after that, the Provider can discover the receiver and send data and also receive a response from it.

I just repeat this process continuously as the Recipient receives the data and then the Provider detects this and sends the data to that Recipient.

My problem is that the whole process is working fine, but after 20 minutes or 30 minutes, the provider has not found and allowed the receiver. And not even throwing any exceptions to the log like detection failed or something. I tried restarting the app, restarting the device with no luck.

I finally found a job like uninstalling the app, restarting the devices and reinstalling the app and starting it up. But I am unable to implement the functionality of this work.

If anyone gives a solution for this, that would be great for me.

+3


source to share





All Articles