android print intent
DESCRIPTION
Some printer vendors make photo printing application freely available in Google’s Android Marketplace. Those applications allow printing of photos from an Android phone to a nearby printer and currently, only photos stored in the Android Gallery (a folder on the SDCard) can be printed. However, there are many great Android applications available that work with photos that are not kept in the Android Gallery, e.g. Flickr or Picasa Photo viewing application, gathering content from the cloud. Android’s open architectures allows applications to temporarily transfer control to other installed applications, to perform certain tasks. I’m going to show how to enable printing in your Android applications, by re-using intents, implemented in other apps. If such intents can be found on a device, we will programmatically walk the user through its installation process, which would happen through the Android Marketplace.TRANSCRIPT
![Page 1: Android Print Intent](https://reader031.vdocument.in/reader031/viewer/2022013102/556a3c48d8b42a4a1e8b46f5/html5/thumbnails/1.jpg)
© Copyright 2011 Wolf Paulus
Intents & Printing on
ANDROID application fundamentals:
![Page 2: Android Print Intent](https://reader031.vdocument.in/reader031/viewer/2022013102/556a3c48d8b42a4a1e8b46f5/html5/thumbnails/2.jpg)
© Copyright 2011 Wolf Paulus2
agenda
•Cloud Printing
•Local Wifi printing from Android
•Enable Printing in your Android Application
•Writing a cool FingerPaint app that prints your Artwork to photo paper
![Page 3: Android Print Intent](https://reader031.vdocument.in/reader031/viewer/2022013102/556a3c48d8b42a4a1e8b46f5/html5/thumbnails/3.jpg)
© Copyright 2011 Wolf Paulus
Vendor Proprietary Solution
Print Configuration Page, showing printer’s email address Register printer at http://www.hp.com/go/eprintcenter Send email to the printer’s email address to get attachments printed
![Page 4: Android Print Intent](https://reader031.vdocument.in/reader031/viewer/2022013102/556a3c48d8b42a4a1e8b46f5/html5/thumbnails/4.jpg)
© Copyright 2011 Wolf Paulus
Vendor Proprietary Solution
![Page 5: Android Print Intent](https://reader031.vdocument.in/reader031/viewer/2022013102/556a3c48d8b42a4a1e8b46f5/html5/thumbnails/5.jpg)
© Copyright 2011 Wolf Paulus
Vendor Proprietary Solution
![Page 6: Android Print Intent](https://reader031.vdocument.in/reader031/viewer/2022013102/556a3c48d8b42a4a1e8b46f5/html5/thumbnails/6.jpg)
© Copyright 2011 Wolf Paulus
Vendor Proprietary Solution
.... when used on an Android Phone
![Page 7: Android Print Intent](https://reader031.vdocument.in/reader031/viewer/2022013102/556a3c48d8b42a4a1e8b46f5/html5/thumbnails/7.jpg)
© Copyright 2011 Wolf Paulus
Andr
oid Br
owse
r App
: http
://m
ail.go
ogle.
com
![Page 8: Android Print Intent](https://reader031.vdocument.in/reader031/viewer/2022013102/556a3c48d8b42a4a1e8b46f5/html5/thumbnails/8.jpg)
© Copyright 2011 Wolf Paulus
Andr
oid G
mail A
pp
![Page 9: Android Print Intent](https://reader031.vdocument.in/reader031/viewer/2022013102/556a3c48d8b42a4a1e8b46f5/html5/thumbnails/9.jpg)
Southwest Airlin
es - Print Boarding Passes and Security
Documents
472159984
RR
Southwest Airlines Boarding Pass
BOARDING PASS
PAULUS/WOLF
FLIGHT 601
MAY 17
PNR: QWQ3JX
601SAN DIEGO
to SAN JOSE 08:30 AM B
Boarding
Group
Position
Printed at
66
Notices and Other Important Information
- - - - -
- - - - -
- - - - -
- - - - -
- - - - -
FOLD HERE - - - - -
- - - - -
- - - - -
- - - - -
- - - - -
© Copyright 2011 Wolf Paulus
Forward to ePrinter’s email address:
9
![Page 10: Android Print Intent](https://reader031.vdocument.in/reader031/viewer/2022013102/556a3c48d8b42a4a1e8b46f5/html5/thumbnails/10.jpg)
© Copyright 2011 Wolf Paulus
Google’s cloud print solution
![Page 11: Android Print Intent](https://reader031.vdocument.in/reader031/viewer/2022013102/556a3c48d8b42a4a1e8b46f5/html5/thumbnails/11.jpg)
© Copyright 2011 Wolf Paulus
Google’s cloud print solution
Install the Google Chrome Web Browser on a PC/Mac that is on the printer’s LANOpen Chrome’s “Preferences / Under the Hood” pageClick “Sign in to Google Cloud Print Button” on the very bottom of the pageSign-in with your Google / Gmail credentialsAll the Printer’s known to the registering PC/Mac are now available.
![Page 12: Android Print Intent](https://reader031.vdocument.in/reader031/viewer/2022013102/556a3c48d8b42a4a1e8b46f5/html5/thumbnails/12.jpg)
© Copyright 2011 Wolf Paulus
![Page 13: Android Print Intent](https://reader031.vdocument.in/reader031/viewer/2022013102/556a3c48d8b42a4a1e8b46f5/html5/thumbnails/13.jpg)
© Copyright 2011 Wolf Paulus
![Page 14: Android Print Intent](https://reader031.vdocument.in/reader031/viewer/2022013102/556a3c48d8b42a4a1e8b46f5/html5/thumbnails/14.jpg)
© Copyright 2011 Wolf Paulus
Google’s cloud print solution
.... when used on an Android Phone
![Page 15: Android Print Intent](https://reader031.vdocument.in/reader031/viewer/2022013102/556a3c48d8b42a4a1e8b46f5/html5/thumbnails/15.jpg)
© Copyright 2011 Wolf Paulus
![Page 16: Android Print Intent](https://reader031.vdocument.in/reader031/viewer/2022013102/556a3c48d8b42a4a1e8b46f5/html5/thumbnails/16.jpg)
© Copyright 2011 Wolf Paulus
Best of both Worlds:http://www.google.com/landing/cloudprint/hp-enable.html
![Page 17: Android Print Intent](https://reader031.vdocument.in/reader031/viewer/2022013102/556a3c48d8b42a4a1e8b46f5/html5/thumbnails/17.jpg)
<script src="//www.google.com/cloudprint/client/cpgadget.js"/>
<script defer="defer"> var gadget = new cloudprint.Gadget(); gadget.setPrintButton( cloudprint.Gadget.createDefaultPrintButton("default_print_button_container")); gadget.setPrintDocument("url", "Cloud Print test page", "http://www.google.com/landing/cloudprint/testpage.pdf");</script>
© Copyright 2011 Wolf Paulus
http://www.google.com/webelements/#!/cloudprint
![Page 18: Android Print Intent](https://reader031.vdocument.in/reader031/viewer/2022013102/556a3c48d8b42a4a1e8b46f5/html5/thumbnails/18.jpg)
© Copyright 2011 Wolf Paulus18
agenda
•Cloud Printing
•Local Wifi printing from Android
•Enable Printing in your Android Application
•Writing a cool FingerPaint app that prints your Artwork to photo paper
![Page 19: Android Print Intent](https://reader031.vdocument.in/reader031/viewer/2022013102/556a3c48d8b42a4a1e8b46f5/html5/thumbnails/19.jpg)
© Copyright 2011 Wolf Paulus19
![Page 20: Android Print Intent](https://reader031.vdocument.in/reader031/viewer/2022013102/556a3c48d8b42a4a1e8b46f5/html5/thumbnails/20.jpg)
© Copyright 2011 Wolf Paulus20
Scan to install
![Page 21: Android Print Intent](https://reader031.vdocument.in/reader031/viewer/2022013102/556a3c48d8b42a4a1e8b46f5/html5/thumbnails/21.jpg)
© Copyright 2011 Wolf Paulus21
agenda
•Cloud Printing
•Local Wifi printing from Android
•Enable Printing in your Android Application
•Writing a cool FingerPaint app that prints your Artwork to photo paper
![Page 22: Android Print Intent](https://reader031.vdocument.in/reader031/viewer/2022013102/556a3c48d8b42a4a1e8b46f5/html5/thumbnails/22.jpg)
© Copyright 2011 Wolf Paulus
android Print Intent
22
Intent intent = new Intent(“org.androidprinting.intent.action.PRINT”);
intent.addCategory(Intent.CATEGORY_DEFAULT);
intent.setDataAndType(mUri, "application/pdf"); // printable content
startActivityForResult(intent, REQUEST_CODE_PRINT_FILE);
![Page 23: Android Print Intent](https://reader031.vdocument.in/reader031/viewer/2022013102/556a3c48d8b42a4a1e8b46f5/html5/thumbnails/23.jpg)
© Copyright 2011 Wolf Paulus23
![Page 24: Android Print Intent](https://reader031.vdocument.in/reader031/viewer/2022013102/556a3c48d8b42a4a1e8b46f5/html5/thumbnails/24.jpg)
© Copyright 2011 Wolf Paulus
add Printing to your application
1. Check that Print-Intent can be handledIf not, programmatically download HP iPrint Photo from Google Marketplace
2. Create Print Intent
3. Create Image Uri
4. Call startActivity() or startActivityForResult() w/ created Intent
24
![Page 25: Android Print Intent](https://reader031.vdocument.in/reader031/viewer/2022013102/556a3c48d8b42a4a1e8b46f5/html5/thumbnails/25.jpg)
© Copyright 2011 Wolf Paulus25
0 < getPackageManager().queryIntentActivities(intent, 0).size();
is Intent available
![Page 26: Android Print Intent](https://reader031.vdocument.in/reader031/viewer/2022013102/556a3c48d8b42a4a1e8b46f5/html5/thumbnails/26.jpg)
© Copyright 2011 Wolf Paulus26
int REQUEST_CODE = 1001;
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=com.hp.android.print"));
startActivityForResult(intent, REQUEST_CODE);
install apk
![Page 27: Android Print Intent](https://reader031.vdocument.in/reader031/viewer/2022013102/556a3c48d8b42a4a1e8b46f5/html5/thumbnails/27.jpg)
© Copyright 2011 Wolf Paulus27
Intent intent= new Intent("org.androidprinting.intent.action.PRINT");
intent.addCategory(Intent.CATEGORY_DEFAULT);
intent.setDataAndType(saveBitmap(mView.mBitmap), "image/*");
startActivity(intent);
printing
![Page 28: Android Print Intent](https://reader031.vdocument.in/reader031/viewer/2022013102/556a3c48d8b42a4a1e8b46f5/html5/thumbnails/28.jpg)
© Copyright 2011 Wolf Paulus
code + demo
![Page 29: Android Print Intent](https://reader031.vdocument.in/reader031/viewer/2022013102/556a3c48d8b42a4a1e8b46f5/html5/thumbnails/29.jpg)
© Copyright 2011 Wolf Paulus29
agenda
•Cloud Printing
•Local Wifi printing from Android
•Enable Printing in your Android Application
•Writing a cool FingerPaint app that prints your Artwork to photo paper
![Page 30: Android Print Intent](https://reader031.vdocument.in/reader031/viewer/2022013102/556a3c48d8b42a4a1e8b46f5/html5/thumbnails/30.jpg)
© Copyright 2011 Wolf Paulus
code + demo
![Page 31: Android Print Intent](https://reader031.vdocument.in/reader031/viewer/2022013102/556a3c48d8b42a4a1e8b46f5/html5/thumbnails/31.jpg)
© Copyright 2011 Wolf Paulus31
Summary•Cloud Printing .. Google Cloud / HP Cloud / Best of Both Worlds
•Local WiFi printing from Android w/ HP iPrint Photo
•Enable Printing in your Android Application in four easy steps
![Page 32: Android Print Intent](https://reader031.vdocument.in/reader031/viewer/2022013102/556a3c48d8b42a4a1e8b46f5/html5/thumbnails/32.jpg)
© Copyright 2011 Wolf Paulus32
![Page 33: Android Print Intent](https://reader031.vdocument.in/reader031/viewer/2022013102/556a3c48d8b42a4a1e8b46f5/html5/thumbnails/33.jpg)
© Copyright 2011 Wolf Paulus33
Thanks for Coming