Print Intent for Google Cloud Print App

2020-07-23 06:38发布

As of today, the official Cloud Print documentation from Google still tells you to include the PrintDialogActivity into your app to print documents using Google Cloud Print. However, it's now also possible to print using the official Google Cloud Print app. I couldn't find any documentation for that though.

1条回答
仙女界的扛把子
2楼-- · 2020-07-23 07:04

The answer is pretty straightforward, but it still took me a few days to figure it out:

Intent printIntent = new Intent(Intent.ACTION_SEND);
printIntent.setType("text/html");
printIntent.putExtra(Intent.EXTRA_TITLE, "some cool title for your document");
printIntent.putExtra(Intent.EXTRA_STREAM, uri);

startActivity(printIntent);

That's the correct way to do it. Important: Intent.ACTION_SEND_MULTIPLE does NOT work at the moment.

查看更多
登录 后发表回答