This tutorial covers creating a print order to be submitted for printing and posting.
If you haven't already, see the README for an initial overview and instructions for adding the SDK to your project.
- Initialise the SDK
- Create
Asset
representations of all the images you want to print - Retrieve an up-to-date catalogue of available products.
- Create
Job
's for the desired products you want to print and attach the assets created in Step 2 - Create an
Order
and attach your job(s) created in Step 4
-
Initialize the SDK and provide your API Keys (these can be found in the Credentials section of the development dashboard). You'll typically initialize the SDK once at application startup. You will also need to supply a context.
KiteSDK.initialise( MyActivity.this, "REPLACE_WITH_YOUR_API_KEY", KiteSDK.DefaultEnvironment.TEST );
Note: Test/Sandbox orders will not be printed and posted. The Test/Sandbox environment is purely for testing during development. If you want to submit a real order that will be printed and posted just use your live API key and the
KiteSDK.DefaultEnvironment.LIVE
environment -
Create
Asset
representations for every image you want to print.Asset
has many constructors (including ones not listed below) to support any use case you may have.ArrayList<Asset> assets = new ArrayList<Asset>(); assets.add(new Asset(R.drawable.photo)); assets.add(new Asset(new URL("http://psps.s3.amazonaws.com/sdk_static/4.jpg"))); assets.add(new Asset("/mnt/external_sd/1.png"));
-
Retrieve an up-to-date catalogue of available products.
kiteSDK.getCatalogueLoader().requestCatalogue( new ICatalogueConsumer() { @Override public void onCatalogueSuccess( Catalogue catalogue ) { /* Create your order */ } @Override public void onCatalogueError( Exception exception ) { /* Handle gracefully */ } } );
-
Create
Job
's for every type of product you want to print in this order. An order may have multiple jobs attached.Job magnets = Job.createPrintJob( catalogue.getProductById( "magnets" ), assets ); Job polaroids = Job.createPrintJob( catalogue.getProductById( "polaroids" ), assets ); Job squarePrints = Job.createPrintJob( catalogue.getProductById( "squares" ), assets );
Note: The above shows only a small sample of the products available for printing with the SDK. Also, the product ids may vary according to those available for your API key.
-
Create an
Order
and attach the job(s) you created in the previous step.Order order = new Order(); order.addJob( magnets ); order.addJob( polaroids ); order.addJob( squarePrints );
- If you're using the Managed Checkout flow where you use our checkout and payment UI then
create and start a
CheckoutActivity
passing it theOrder
object you created in Step 4 - Alternatively if you're building your own Custom Checkout UI then it's time to set the shipping address to which the order will be delivered