Intents

Last updated: December 1th, 2018

Test coverage & Examples

I ask you to forgive me for the mistakes made in previous versions of the program. At the moment I have written a test suite. Each test in the application checks one of the methods of interaction with the program.

On this page I will not repeat the texts of the examples. I will describe only the interaction features.

GitHub: 402d/DemoRawBtPrinter

Google Play: Test RawBT

Standard Print on Android

In Android 4.4 (API level 19) and higher, the framework provides services for printing images and documents directly from Android applications. Being able to print information from your Android application gives users a way to see a larger version of the content from your app or share it with another person who is not using your application. Printing also allows them to create a snapshot of information that does not depend on having a device, sufficient battery power, or a wireless network connection.

Documentation: developer.android.com/training/printing/

If you implement the standard method, you can print not only through my application, but to any printer.

Printing HTML documents:

Please note that the function text is different from the example in the official documentation.

I have written a complete application to illustrate this example. The source code of the program is available on GitHub . The application is available in the market and really used as an extension to RawBT (option for editor).

GitHub: 402d/TextToPrint

Google Play: Text To Print

Printing from existing applications

GitHub: AndroidManifest.xml

I'll show you my function of parsing the data that came into the application.

Parse intent:

Print UTF-8 text with formatting

The printer does not understand the UTF-8. The program converts them into one byte encoding of your language.

class EscGeneral implements PosDriverInterface

For most languages, there is a problem with ESC/p command contained characters from the range [128-255].

If such characters are processed separately, then the problem is with the Portuguese language( and others languages used symbols U+00C0 - U+00FF ).

How make string from ESC POS codes:

But it is better to use ready-made classes from printer manufacturers SDK for these purposes.

Using the application as a driver to transfer data to a peripheral device

  • 1. Intent.VIEW or Intent.Send files with .prn extension
  • 2. Scheme RawBT,base64

Transfer data with call startService()

Since 2.80 See 402d/DemoRawBtPrinter method test15() & test16() on GitHub.