0

I was wondering how I can create and start an intent using this:

"qsrtech.posprintdriver/.printservice"

I downloaded the POS Printer Driver (ESC) app (which is the app I am trying to access).

I tried this:

        String PrintPage = "qsrtech.posprintdriver/.printservice";
        Intent intent = new Intent(Intent.ACTION_MAIN);             
        intent.setComponent(ComponentName.unflattenFromString(PrintPage));             
        intent.addCategory(Intent.CATEGORY_LAUNCHER );             
        startActivity(intent); 

However, I get an error saying: "No activity found to handle this intent"

I was wondering if there is anything I can do to access this intent? The thing is that I'm not sure if I'm accessing an activity or a background service (probably an intent service?) from a different app.

Here is the link that explains more about this intent. http://www.qsrtechnologies.com/aboutposdriver.html

Kofi
  • 65
  • 1
  • 2
  • 11
  • 1
    try `"qsrtech.posprintdriver/qsrtech.posprintdriver.printservice"` as your component string to unflatten. Also it looks like you aren't adding any data, so I doubt anything will get printed, you'll probably want to include the `putExtra("Data", somethingToPrint)` – FoamyGuy Jun 03 '13 at 20:04
  • Thanks FoamyGuy for your quick response. So your answer helped me get rid of the "No Activity found to handle this intent" error. However, not I have an "Unable to find explicit class, have you declared this activity in your androidmanifest.xml?" error. I added: to my androidmanifest.xml file. I don't have this Java class in my project (because I'm assuming that it's in another app). Any suggestions on how I can solve this issue? Thanks again. – Kofi Jun 03 '13 at 21:52
  • You could try the solutions posted here: http://stackoverflow.com/questions/5940456/code-to-launch-external-app-explicitly – Torben Kohlmeier Jun 03 '13 at 22:46

2 Answers2

0

You can try with this :

Intent sendIntent = new Intent();
sendIntent.setAction(Intent.ACTION_SEND);
sendIntent.putExtra("Data", "Test printer\n\n");
sendIntent.setComponent(new ComponentName("qsrtech.posprintdriver","qsrtech.posprintdriver.printservice"));
startService(sendIntent);
-1
Intent sendIntent = new Intent();
sendIntent.setAction(Intent.ACTION_SEND);
sendIntent.putExtra("Data", "Test printer\n\n");
sendIntent.setComponent(new ComponentName("qsrtech.posprintdriver","qsrtech.posprintdriver.printservice"));
startService(sendIntent); 

Worked like a charm here.

Dr. Ehsan Ali
  • 4,735
  • 4
  • 23
  • 37
  • Yes, I just wanted to to confirm that the mentioned code works. Anyway I was only could print characters and not ESC code. I guess because the "ESC POS Android Driver" is not free and must be purchased. is it ? – Dr. Ehsan Ali Feb 11 '15 at 15:06