Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android: How to print an HTML page directly on Samsung Mobile Print

I'm developing an Android application and I want to print an HTML page via the Samsung Mobile Print app. What are the intent parameters that I need to do this i.e.

  • package name

  • MIME type

  • Action type (ACTION_SEND, ACTION_VIEW e.t.c)

  • any other parameters that are required.

Is there a way I can find out these parameters? I managed to find out the package name using adb shell but when I tried to pass the HTML page as a bundle, it throw an ActivityNotFoundException (No Activity found to handle ACTION_SEND).

I know there are other options for printing such as PrinterShare Pro and Gooble Cloud Print but I'm developing this application for a client and so I have to communicate with the Samsung Mobile Print app.

Thanks for your help.

like image 365
W.K.S Avatar asked Dec 13 '25 03:12

W.K.S


1 Answers

I contacted the developers of the Samsung Mobile Print app and they provided the following code:

Intent intent = new Intent("com.sec.print.mobileprint.action.PRINT");
Uri uri = Uri.parse("http://www.samsung.com");
intent.putExtra("com.sec.print.mobileprint.extra.CONTENT", uri );
intent.putExtra("com.sec.print.mobileprint.extra.CONTENT_TYPE", "WEBPAGE");
intent.putExtra("com.sec.print.mobileprint.extra.OPTION_TYPE", "DOCUMENT_PRINT");
intent.putExtra("com.sec.print.mobileprint.extra.JOB_NAME", "Untitled");
startActivity(intent);
like image 113
W.K.S Avatar answered Dec 15 '25 17:12

W.K.S



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!