ERROR_WRONG_LABEL when trying to print wireless using Android Brother Sdk for label printer

后端 未结 3 994
没有蜡笔的小新
没有蜡笔的小新 2020-12-06 19:48

I have trying to print using labels from my android app which using wifi commands Brother QL-720NW label printer. Since I performed factory

3条回答
  •  爱一瞬间的悲伤
    2020-12-06 20:05

    TL;DR I solved by setting the workPath attribute:

    printerInfo.workPath = context.cacheDir.Path
    

    I noticed that the setPrinterInfo was returning false and when trying to print I received the WRONG_LABEL error code. Debugging the code I figured out that it's related to file writing permission that Brother SDK requires. The documentation is confusing and mentions about needing the WRITE_EXTERNAL_STORAGE if workPath isn't set. Even having this permission I could not make it work. I solved by setting the workPath attribute as shown above.

提交回复
热议问题