Skip to content

How to trigger feedback using SDK

To trigger custom feedback, use the API pgManager.triggerFeedback. The function takes a predefined feedback ID (PgPredefinedFeedback) wrapped in a PgCommand and an implementation of the IPgFeedbackCallback callback as arguments.

After feedback is successfully triggered on the scanner (or in case of any errors) the IPgFeedbackCallback is called with the relevant information.

The PgPredefinedFeedback ID defines the feedback sequence to be played. The convenience function PgPredefinedFeedback.toComamnd() used here to wrap PgPredefinedFeedback optionally takes a PgCommandParams object, which gives additional control over how the command is executed.

For now we only support the replaceQueue flag here, which, if set to true, cancels all the commands currently in the queue and adds itself as the first element.
To learn more, see Queueing behavior.

 val feedbackId = PgPredefinedFeedback.SPECIAL_1
 pgManager.triggerFeedback(feedbackId.toCommand(), object : IPgFeedbackCallback {
    override fun onSuccess() {
    // everything worked

    override fun onError(error: PgError) {
    // handle the error

Possible feedback IDs are:

  • PgPredefinedFeedback.SUCCESS - Positive feedback (ACK) - green
  • PgPredefinedFeedback.ERROR - Negative feedback (NACK) - red
  • PgPredefinedFeedback.SPECIAL_1 - Special feedback 1 - yellow

NOTE: Starting with MARK firmware v2.0.0, feedback triggered this way temporarily overwrites the scanner's global feedback settings. For example, the sequences mentioned above play the sound even though the scanner is configured to be silent.

How to trigger feedback with setting the screen

If you are using a MARK Display with Worker feedback, we suggest you follow this order to get the best behavior:

  1. Set the screen
  2. Send the feedback command

You do not have to wait for the setScreen command to return before sending the feedback command. The commands are queued automatically and feedback is triggered immediately after the screen is set.
Do not use the replace queue flag as that could cancel the sequence. Make sure not to send feedback before setting the screen. In that case, the screen is only set after feedback is completed which is not ideal.