Upload
wolf-paulus
View
10.879
Download
11
Tags:
Embed Size (px)
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.
Citation preview
© Copyright 2011 Wolf Paulus
Intents & Printing on
ANDROID application fundamentals:
© 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
© 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
© Copyright 2011 Wolf Paulus
Vendor Proprietary Solution
© Copyright 2011 Wolf Paulus
Vendor Proprietary Solution
© Copyright 2011 Wolf Paulus
Vendor Proprietary Solution
.... when used on an Android Phone
© Copyright 2011 Wolf Paulus
Andr
oid Br
owse
r App
: http
://m
ail.go
ogle.
com
© Copyright 2011 Wolf Paulus
Andr
oid G
mail A
pp
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
© Copyright 2011 Wolf Paulus
Google’s cloud print solution
© 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.
© Copyright 2011 Wolf Paulus
© Copyright 2011 Wolf Paulus
© Copyright 2011 Wolf Paulus
Google’s cloud print solution
.... when used on an Android Phone
© Copyright 2011 Wolf Paulus
© Copyright 2011 Wolf Paulus
Best of both Worlds:http://www.google.com/landing/cloudprint/hp-enable.html
<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
© 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
© Copyright 2011 Wolf Paulus19
© Copyright 2011 Wolf Paulus20
Scan to install
© 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
© 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);
© Copyright 2011 Wolf Paulus23
© 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
© Copyright 2011 Wolf Paulus25
0 < getPackageManager().queryIntentActivities(intent, 0).size();
is Intent available
© 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
© 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
© Copyright 2011 Wolf Paulus
code + demo
© 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
© Copyright 2011 Wolf Paulus
code + demo
© 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
© Copyright 2011 Wolf Paulus32
© Copyright 2011 Wolf Paulus33
Thanks for Coming