Create Registration QR Code for Custom Mobile App

HYPR Mobile App can be used to scan a registration QR code. This QR code contains a dynamic deep link that in turn contains the HYPR subdomain--useful if you want to have your own Mobile App for consumers and need to generate a registration QR code to be scanned by your custom Mobile App device’s camera. In this scenario, the existing CC client library cannot be used to generate the registration QR code containing the dynamic deep link. This article covers a possible custom implementation in your custom registration application.

Approach - Registration QR Code Generation

  1. Get the registration QR code using the Control Center (CC) client library.

  2. Decode the base64-encoded QR code generated by the CC server.

  3. Link the decoded QR code to ImageStream.

  4. Use a third-party Java library (Google ZXing) to decode the ImageSream data to a QR code .json payload.

  5. Prefix the .json payload with the dynamic link custom subdomain.

  6. Use Google ZXing to encode the prefixed .json payload to a QR code.

Custom Java Code - Registration QR Code Generation

String hyprServerBaseURL = "";
String hyprAppId = "testApplication";
String hyprApiToken = "abcdefghijklmnopqrstuvwxyz";
HYPRConfiguration hyprConfiguration = new HYPRConfiguration(hyprServerBaseURL, hyprAppId);
ClientRegistrationAPIClient clientRegAPIClient = new ClientRegistrationAPIClient(hyprConfiguration);
String randomPin = WebUtils.generateRandomPIN() + "";
String strqrCode = clientRegAPIClient.getQRCode(randomPin);

byte[] decodedQRCode  = Base64.decodeBase64(strqrCode);
String strDecodedQRCode = new String(decodedQRCode, StandardCharsets.UTF_8);

InputStream in = new ByteArrayInputStream(decodedQRCode);
ImageInputStream qrIn = ImageIO.createImageInputStream(in);
BufferedImage bufferedImage =;

LuminanceSource source = new BufferedImageLuminanceSource(bufferedImage);
BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(source));
Result result = (new MultiFormatReader()).decode(bitmap);
String jsonString = result.getText();

String dynamicLinkBaseUrl = "";
String dynamicLink = dynamicLinkBaseUrl + "?link=" + URLEncoder.encode(jsonString);
File file = Paths.get("/Users/sprasad/Desktop",new String[] {"QRReg.png"}).toFile();
String path = file.getAbsolutePath();
Map<EncodeHintType, ErrorCorrectionLevel> hashMap = new HashMap<EncodeHintType, ErrorCorrectionLevel>();
hashMap.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.L);
BitMatrix matrix = new MultiFormatWriter().encode(new String(dynamicLink.getBytes("UTF-8"), "UTF-8"),BarcodeFormat.QR_CODE, 200, 200);
MatrixToImageWriter.writeToFile(matrix,path.substring(path.lastIndexOf('.') + 1), new File(path));
Version Date Comment
Current Version (v. 3) May 11, 2022 18:54 Khedron de León
v. 2 Dec 21, 2021 01:54 Ryan Rowcliffe
v. 1 Dec 21, 2021 00:53 Sujai Prasad
Was this article helpful?
0 out of 0 found this helpful