Call HP ePrint for Android

I'm working on an Android app that should invoke the HP ePrint Android app for wireless printing. For this purpose I use the code:

Intent intent = new Intent ("com.hp.android.print.PRINT");
intent.setPackage ("com.hp.android.print");

startActivityForResult (intent, 0);

I am sure that I did not get the right action ... Does anyone know what is the right action to invoke this HP ePrint app? And how can I pass the exact file for printing (intent.putExtra (...)).

thank

+5
source share
2 answers

After more than 10 hours, I managed to find a solution. The correct code to invoke the HP ePrint application is as follows:

    Uri uri = Uri.fromFile (f);
    Intent intent = new Intent ("org.androidprinting.intent.action.PRINT");
    intent.setDataAndType( uri, "text/plain" );
    context.startActivityForResult(intent, 0);

+13

, Android 5.0.1 JPEG, ( HP ePrint 3.4):

Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
Uri uri = Uri.fromFile(new File("something.jpg"));
intent.setDataAndType(uri, "image/*");
activity.startActivity(intent);

, , -, "A4" "plain". ( "".)

, Intent HP ePrint.

+1

All Articles