c# Maui Zebra.Printer.SDK cannot find any printers

// Expert user has replied.
D David Kermott 2 years 1 month ago
1232 10 0

https://techdocs.zebra.com/link-os/2-12/pc/content/com/zebra/sdk/printe…
I pulled some sample c# code from the above link and made some slight modifications to get it to run.
The FindPrinters command doesn't seem to do anything.
I attached the Sample Code.txt file with what I was attempting.

The scenario I am attempting is this:
The app allows the user to supply the printer device name (like USBELPRW001).
When the user attempts to login to the app it will search for the printer.
If the app cannot find the printer the user cannot continue.
When the user logs out of the app the printer is disconnected and unpaired.

Please Register or Login to post a reply

10 Replies

D David Kermott

I thought I had posted this issue a week ago. I think the submission of discussions needs some work. I clicked Preview and then the only button was subscribe to updates. I pressed that and got an error. I clicked back once or twice and clicked "Save" and then "Subscribe" and then it worked.
I had also put this request through the technical support group two or three weeks ago. They said to open a discussion with the developers (Case 13765633). I see the value of having visibility for the community but there really should be something explaining that developers from Zebra will review these and respond.

S Steven Si

Hi David,

By looking at the sample code.txt posted by you in this discussion thread, it seems like you are trying to discover the Bluetooth printers from an app in Android. Not sure if you are aware about the Bluetooth discovery restriction enforced in the Android 10 and higher, which requires the ACCESS_FINE_LOCATION permission must be declared in the app's manifest file and requested explicitly. Otherwise, the Bluetooth discovery won't start. Please refer to this article for more details:  Link-OS SDK for Android | Permissions and Bluetooth API.

A Alfred Teixeira

Have you tried the C# sample code unmodified? If so, does it discover the printers?
Which printer model(s) is/are you trying to discover?
Are you attempting BT discovery or network discovery?
if BT
You will need to use the following method: FindBluetoothPrinters
Do the printer(s)'s BT configuration(s) include being set to allow it/them to be discovered?
Can you get the printer(s)'s current BT settings and post it/them? If you still have an active support case, please get your printer(s)'s AllCV(s) and
submit it/them to the support case.
if Network
Are the printer(s) on the same subnet as the device you are running the sample app?

There are developer demos for Xamarin among the sample code available with the link-os multi-platform SDK; I would recommend you download/install this SDK and try one of the Xamarin developer demos to see if it can locate your printer(s).

D David Kermott

I must have pasted the wrong url in my previous message.
Here's the URL I got the sample code from:
https://techdocs.zebra.com/link-os/2-14/pc_net/content/html/920db44d-4f…

When I try the unmodified code the only error I get is "No overload for method FindPrinters contains one argument".
The intellisense says this for parameters:
void BluetoothDiscoverer.FindPrinters(Context context, DiscoveryHandler discoveryHandler, DeviceFilter deviceFiter) (+1 overload). The other overload requires only Context and DiscoveryHandler.

Intellisense does not show a method called FindBluetoothPrinters in the BluetoothDiscoverer (which would seem a bit redundant with the naming).

I already created a Tech Support ticket and they told me to create a discussion on developer.zebra.com. Case 13765633.
I added more info to the support ticket Case 13765633 including a screenshot.

<strong>I'm not impressed with your support website. How many places do I have to login? I lost what I typed because I added a screenshot. I know better than to click the "Preview" button.</strong>

A Alfred Teixeira

Hello David,

I reviewed your case; the support agent appears to be waiting on some information he requested; were you able to provide that information?

As per my previous posting, I would recommend you download/install the link-os multi-platform SDK and try one of the Xamarin developer demos (sample applications) that are included to see if the printer discovery works as expected. You can download this SDK-installer from the following link: https://www.zebra.com/us/en/support-downloads/printer-software/link-os-…
AT

D David Kermott

I have had the following permissions in the AndroidManifest.xml file since before I started scanning for BT devices

uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"
uses-permission android:name="android.permission.INTERNET"
uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"
uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"

uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"
uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"

uses-feature android:name="android.hardware.bluetooth"
uses-permission android:name="android.permission.BLUETOOTH"
uses-permission android:name="android.permission.BLUETOOTH_ADMIN"
uses-permission android:name="android.permission.BLUETOOTH_CONNECT"
uses-permission android:name="android.permission.BLUETOOTH_SCAN"

S Steven Si

An explicit user permission request is also required for the Bluetooth Discovery to work. Please see https://developer.android.com/training/permissions/requesting on how to request the permission in the app.

D David Kermott

I've done this before but will try again.

Previously, when I checked to see if I already had bt permissions it returned "Granted" right away so I didn't need to actually perform the request.

S Steven Si

It's not the Bluetooth permission. It's the ACCESS_FINE_LOCATION permission, which allows the app to search for the nearby devices.

D David Kermott

I suspect some settings from MobiControl are preventing prompting for fine location permission.  My code works fine if I deploy to a standard android device (my phone) but not when it is deployed to the Zebra scan-gun (managed through MobiControl).

I re-worked how printer configuration is performed within the app.  An administrator will scan the BT Printer UPC mac address on the bottom of the printer.  I use Zebra.Sdk.Comm to facilitate the automatic bonding through the BluetoothConnection function.

With this process change I no longer need to search for available bt devices.

CONTACT
Can’t find what you’re looking for?