开发者

How to open PrinterShare application in android from my current application

As I am developing an android app, I came across the need of launching the PrinterShare app installed on my android phone. I want that when user hits the Button control in my app, it should launch the PrinterShare app. When user is done with the document which he/she needs to print, then it should come back to home application, from when it was launched.

Any idea, code snippet would be appreciated开发者_Python百科. Thanks.. :-)


Lately but fortunately I got the answer. Here it is:

Intent i = new Intent(Intent.ACTION_VIEW);
i.setPackage("com.dynamixsoftware.printershare");
i.setDataAndType(printFileUri,"text/plain");
startActivity(i);

where 'printFileUri' is as follows:

static final Uri printFileUri = Uri.parse("file:///sdcard/Calci_print.txt");

If anyone has still another suggestion, its most welcomed.. :-)


If you receive an ActivityNotFoundException, take a look at the actual name of the installed package (pm command from Android console). In my case I found that the copy I bought from the Amazon App Store had a package name of com.dynamixsoftware.printershare.amazon.

Given that my users might obtain the PrinterShare app from Google, I actually check the package manager for the first package name beginning with com.dynamixsoftware.printershare.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜