Channel your inner parking inspector and print straight from your app to a bluetooth printer

Blog Post created by MVertzonis-esristaff Employee on Apr 15, 2020

Although I’m generally not excited when I see a parking inspector on the side of the road, the technology nerd in me does always look around to see what gadgets they are using. Gone are the days of a notepad and pencil, instead they usually have an all-in-one device, or a phone with a printer hanging on their belt, to print out the tickets. 


Keen viewers of the AppStudio 4.2 highlights video  would have caught a glimpse of one of our newest samples - Print Location. This sample shows how your app can connect to a bluetooth printer, display a print preview, and send a print job directly to the paired printer. So, although you might not be designing a parking inspector app, you can now add the ability to print information from your app on the spot: a receipt of services completed, or evidence of data entered in the app. 


The printer used in the highlights video is a Zebra iMZ220. We’ve tested this printer on all our supported platforms and have had it whitelisted in AppStudio Player on iOS so you can use it on your iPhone or iPad, as well and Android, Windows, Mac and Ubuntu. Other printers can work in a similar way, and might only need a little tweaking of this current app. This app has not been designed specifically for, or tested with other printers, but can be used as a starting point for your own awesome app that prints to a bluetooth printer. 


Explore the Print Location sample 


The Print Location app is available in AppStudio for you to use as a sample. Of course, to fully test this app you will need a printer, but even if you do not have one, you can try out the print preview and get an idea of how you can use it. 

  1. Launch and sign in to AppStudio on your desktop. 
  2. Click New App, search for and choose Print Location and click Create. 
  3. Click Upload to make this app available in your ArcGIS organisation. 
  4. Launch and sign into Player on your device. 
  5. Browse for and download your new app, and click Play. 


There are three tools in this app: 

  • Settings 
  • Print Preview 
  • Print 


The Settings tool will be familiar to anyone who has worked with our GNSS Discover sample or any of apps that connect to a bluetooth GNSS receiver. The concept here is the same. You first pair the bluetooth accessory with the device, the app needs to then identify that paired device, and then once identified it can send or receive information to or from it. 


The Print Preview demonstrates what information will be sent to the printer. In this sample, see how there is a combination of things that were visible in the app – ie: the map – and things that were visible ie: the coordinates and time stamp. You choose what to print out independently of what is shown on the screen. 


The Print tool is self-explanatory. Whatever is shown in the print preview, is what is sent to the printer when you click Print. 


Things to consider  


  • An app that needs to communicate with a printer needs the Bluetooth capability to be set. 
  • This sample specifically filters for only devices that have ‘iMZ’ or ‘Zebra’ in their name. If you are experimenting with a different printer, remove (or comment out) lines 87 and 89 (leaving line 88) from /BluetoothPlugin/BluetoothManager/BluetoothSources.qml. 

When you do this, you will see that all paired Bluetooth devices will appear in the list. There isn’t a standard device type that can be used to filter for only printers, so once you get your app working with your printer, think of a good name filter to use to hide the noise of all possible pair devices. 

  • Whitelisting is required on iOS. In the case of Apple any hardware accessories that are to be used by an app, need to be identified by that app and vice versa. For details see Apples MFi Program, but the short version is that if you have a printer you want to use on iOS with your app, the printer manufacturer needs to identify your app, and your app needs to identify them. We have already whitelisted the Zebra iMZ220 with Player, but If you have a different printer you’d like to use with your app, I recommend testing it out on Android or Windows first, and then once you have it working on those, consider whitelisting. If you are using Player to run your app – please contact us with information about your printer and we will see it’s a device, we can have whitelisted.