iOS project in cross platform solution cannot find printer, but Android project works fine

The Android project works as expected, but the iOS project will not find my printer. I can connect to the printer in iOS via the Zebra printer app.

The android side goes directly from FindBluetoothPrinters to OnPrinterFound. This iOS goes directly from FindBluetoothPrinters to OnDiscoveryFinished.

Anybody have any ideas as to what might be the problem?

Thanks

MainPage.xaml.cs

private void StartBluetoothDiscovery()
{
Debug.WriteLine("Discovering Bluetooth Printers");
//IDiscoveryHandler bthandler = DependencyService.Get<IDiscoveryHandler>();
IDiscoveryEventHandler bthandler = DiscoveryHandlerFactory.Current.GetInstance();
bthandler.OnDiscoveryError += DiscoveryHandler_OnDiscoveryError;
bthandler.OnDiscoveryFinished += DiscoveryHandler_OnDiscoveryFinished;
bthandler.OnFoundPrinter += DiscoveryHandler_OnFoundPrinter;
System.Diagnostics.Debug.WriteLine("Starting Bluetooth Discovery");
IPrinterDiscovery pd = DependencyService.Get<IPrinterDiscovery>();
if (pd != null)
{
pd.FindBluetoothPrinters(bthandler);
}
}

iOS FindBluetoothPrinters
public void FindBluetoothPrinters(IDiscoveryHandler handler)

{
BluetoothDiscoverer.Current.FindPrinters(null, handler);

}

Android FindBluetoothPrinters
public void FindBluetoothPrinters(IDiscoveryHandler handler)
{
const string permission = Manifest.Permission.AccessCoarseLocation;
if (ContextCompat.CheckSelfPermission(Android.App.Application.Context, permission) == (int)Permission.Granted)
{
BluetoothDiscoverer.Current.FindPrinters(Android.App.Application.Context, handler);
return;
}
TempHandler = handler;
//Finally request permissions with the list of permissions and Id
ActivityCompat.RequestPermissions(MainActivity.GetActivity(), PermissionsLocation, RequestLocationId);
}

John McGinnis
Solved

A PLIST entry is required. (Add a string under Supported External Accessory Protocols. Set that to "com.zebra.rawport")

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Log in to post comments