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

I am developing an Android application and I want to print an HTML page through the Samsung Mobile Print application. What are the intent parameters that I need for this.

  • package name

  • MIME Type

  • Action Type ( ACTION_SEND , ACTION_VIEW etc)

  • any other necessary parameters.

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

I know that there are other printing options, such as PrinterShare Pro and Gooble Cloud Print, but I am developing this application for the client, and therefore I need to communicate with the Samsung Mobile Print application.

Thanks for your help.

+3
source share
1 answer

I contacted the developers of the Samsung Mobile Print application 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); 
+7
source

Source: https://habr.com/ru/post/911903/


All Articles