Hello,I am creating a Xamarin.Forms Cross-Platform mobile application using c# .NET in iOS, and I am trying to integrate the printing functionality through Wi-Fi. Just to give a background - I was able to successfully connect the printer through Bluetooth and the printing works fine. But now, I am trying to implement the same through network/Wi-Fi. I was able to successfully connect the printer to the Wi-Fi and the printer shows the Wi-Fi signal strength and I use this following code to find the printers:
private void StartNetworkDiscovery()
{
OnStatusMessage("Discovering Network Printers");
try
{
IDiscoveryEventHandler nwhandler = DiscoveryHandlerFactory.Current.GetInstance();
nwhandler.OnDiscoveryError += DiscoveryHandler_OnDiscoveryError;
nwhandler.OnDiscoveryFinished += DiscoveryHandler_OnDiscoveryFinished;
nwhandler.OnFoundPrinter += DiscoveryHandler_OnFoundPrinter;
connectionType = ConnectionType.Network;
System.Diagnostics.Debug.WriteLine("Starting Network Discovery");
NetworkDiscoverer.Current.LocalBroadcast(nwhandler);
}
catch (Exception e)
{
System.Diagnostics.Debug.WriteLine("Network Exception: " + e.Message);
}
}
But for some reason, the network printer is not discovered. On Found printer, I add the printer to a list that's displayed in the mobile device. But currently, it is just not displaying any printer information.
Any help to guide me move forward will be appreciated.
Thanks,
Srikanth