Bluetooth and Wifi Printing for Android

Bluetooth and WIFI Printing for Android

Starting with Android 4.4 you can print documents from a device to a hardware printer via wifi.

Android apps can now print any type of content over Wi-Fi or cloud-hosted services such as Google Cloud Print. In print-enabled apps, users can discover available printers, change paper sizes, choose specific pages to print, and print almost any kind of document, image, or file.

A brief example of how to start the printing process:

private void doPrint() {
PrintManager printManager = (PrintManager) getActivity().getSystemService(Context.PRINT_SERVICE);
printManager.print("My document", new CustomPrintDocumentAdapter(getActivity()), null);
}

where CustomPrintDocumentAdapter extends PrintDocumentAdapter.

More information is available on Android Developers.

How to connect a mobile and a printer via WIFI to print a text file in android?

ther is no api provided by google (<19, thanks to @KaranJ), so third part solutions have to be done, eg:

http://www.printershare.com/help-android-integration.sdf
https://developers.google.com/cloud-print/docs/android

a standalone solution would be very difficult! :/

you could use an alert dialog builder, to guide the user to the google playstore, for installing something like printshare or google cloud print.

EDIT

also the content should be laid out to be ready for printing, more here:
http://developer.android.com/reference/android/print/PrintManager.html
http://developer.android.com/training/printing/custom-docs.html



Related Topics



Leave a reply



Submit