Skip to content Skip to sidebar Skip to footer

Invoking Hp Eprint Android Application

I am working on an android app that should invoke android HP ePrint application for wireless printing. For that purpose, I'm using code: Intent intent = new Intent('com.hp.android.

Solution 1:

After more than 10 hours, I managed to find the solution. Right code to invoke HP ePrint application is like this:

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

Solution 2:

After my android 5.0.1 app has created a JPEG file, I use the following code to start a wireless print operation (via HP ePrint version 3.4):

Intentintent=newIntent();
intent.setAction(Intent.ACTION_VIEW);
Uriuri= Uri.fromFile(newFile("something.jpg"));
intent.setDataAndType(uri, "image/*");
activity.startActivity(intent);

The code works cleanly, but every time I print something I have to manually set the paper size to 'A4' and paper type to 'plain'. (It defaults to 'photo'.)

I would be very interested in documentation on how to pass Intent parameters to HP ePrint.

Post a Comment for "Invoking Hp Eprint Android Application"