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.
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.