We configured Odoo POS application in a cloud server and from the desktop, if we click print receipt it will automatically pop up the print dialogue in chrome and can print from the connected device! The same application we developed in android simply putting in webView!
Now I need to print this using connected Bluetooth thermal printer paired to the Android device! I searched a lot but still didn't get any solution! ANy links or suggestions will be great help
If you have access to html/js code of your webpage, you can do as following:
Create special class, that will handle js callbacks:
Enable js for webview. Then add created interface to webView. As the second param you need to specify the name, that will be used inside js. I called it "PrintInterface", the same as class name:
In your js code call appropriate method from PrintInterface. Note that each method must be annotated with
@JavascriptInterface(look 1.):So, finally, inside your PrintInterface#printSome method you can do whatever you want straight from Java code.
Some docs about html printing: https://developer.android.com/training/printing/html-docs