Kotlin and developing Kotlin applications for Zebra devices

Anonymous (not verified) -

It is not news for Android developers that following Google’s announcement of Kotlin support during Google I/O 2017, Google have embraced Kotlin as the preferred development language for Android, even to the extent that the “Build your first app” tutorial on the Android developer site will default to showing Kotlin code.


The Stack Overflow 2018 developer survey gives a non-biased evaluation of the current mindshare of Kotlin: 4.7% of professional developers listed Kotlin as the most popular technology which might not sound high, but it came second in the most loved and fourth in the most wanted categories. Developers who listed Kotlin had the fewest years of professional coding experience​ which is understandable for a language which has only recently seen widespread adoption (this is the first year Stack Overflow have asked about Kotlin).


I was fortunate enough to attend the European Kotlin Conference last month and I spoke with many developers and sponsors about using the language for enterprise development.  There is adoption of Kotlin in the enterprise, although the majority of enterprise Kotlin developers right now are only targeting BYOD use cases, this is very likely to change in the near future.



  • Google’s continued promotion of Kotlin over Java since I/O 2017
  • An awareness of Zebra and ruggedized devices amongst the Kotlin developers I spoke with at KotlinConf
  • The popularity of the language amongst developers in general

I felt it made sense to provide some guidance around how to develop a Kotlin app targeting Zebra devices. There are 2 approaches you could take:

Approach #1: Calling the EMDK library from Kotlin

Java and Kotlin are completely interoperable.  It is entirely possible to write a Kotlin application to consume Zebra’s EMDK for Android library and I have created a proof of concept in this forked branch based on the standard EMDK Barcode Sample 1​ (the important file is MainActivity.kt​).  This fork can be built with Android Studio 3.x and run on any Zebra mobile computer supported by EMDK 6.9.

The proof of concept does not do anything particularly clever, the steps I took were as follows:

  1. Fork the official EMDK for Android Barcode Sample 1 (I could have chosen any version of EMDK, I just chose 6.9 as it was the most recent at the time).
  2. Use the Android Studio feature 'Convert Java file to Kotlin file', CTRL+ALT+SHIFT+K
  3. Tidied up the very few conversion issues, raised by the compiler.

You might get a better view of the differences between the fork and the master branch by comparing a pull request or viewing the Kotlin file directly.

There are some changes the implementation team are working on to make the EMDK library more friendly to Kotlin developers but there is nothing stopping a Kotlin developer using the EMDK library today. 

Approach #2: Using the DataWedge Intent API from Kotlin

DataWedge exposes an Intent-based API.  Many customers use DataWedge in preference to our native SDKs because it takes away all concerns about interfacing with the scanning hardware and reduces the task to integrating with a pre-built service.  I have previously written about using the DataWedge API for Android (Java) appsXamarin apps, Ionic apps, Cordova apps and React Native apps… it makes sense to continue the pattern and show how a Kotlin application could be developed to take advantage of the DataWedge APIs.

My DataWedgeKotlin application is available from github at https://github.com/darryncampbell/DataWedgeKotlin, please clone the repository and follow the instruction in the ReadMe file to get started.  The application comprises two activities, the first displays received scans and can invoke the scanner with a soft button.

The second activity allows for configuration of the selected scanner and uses the DataWedge SET_CONFIG API to make changes to the current scanner configuration.

I think the source code should be fairly self-explanatory but I apologise if it is not idiomatic Kotlin – it is difficult having used Java since my university days.

Whichever way you choose to develop a Kotlin application on Zebra enterprise devices, please do also provide us feedback (either by replying to this post or by posting questions to the developer portal) – the more developers we see using Kotlin, the more we will focus on providing official, formally supported samples and documentation for the technology which will lead to a better experience all round.


Anonymous (not verified)

Young Professional Looking to build knowledge within the field of Information Technologies. Currently working as a help desk analyst providing support to 16 different stores across Ohio.

Please register or login to post a reply