Integrating Peecho's Cloud Print Button into your mobile app

by Gloria Quintanilla in ,

Peecho’s Cloud Print Button makes it easy to turn digital content into professionally printed products like photo books and magazines. It's not hard to add the button to your website and get started selling prints. But what about mobile? In this article, Willem Vermeer, our Senior Java Engineer and founder of our partner company MobPri, will elaborate on how you can leverage the Cloud Print Button in a mobile environment.

Deciding which technical approach works best for you

Mobile developers are still debating what the best technical approach is for developing a mobile app. Possibilities range from optimizing an HTML5/javascript web-solution for mobile use, to programming in the native language of the devices themselves. Solutions that bridge the gap between these options, such as Phonegap or Appcelerator Titanium, are also widely used in the industry. At MobPri, we have chosen for native development for Android devices because we believe this is the best way to achieve optimal user experiences. However, Peecho’s Cloud Print Button can be added to your app using either one of these approaches.

Adding the Cloud Print Button to an HTML WebView within the Android app

There are a few things to consider if you choose to add the Cloud Print Button to an HTML webview within your app. This is basically the same as adding the Cloud Print Button to a website. First, you need to know the characteristics of the document or image you'd like to print. Then, you can add an HTML snippet inside a WebView in one of your Android activities and you're in business. The button can be styled using your own CSS and therefore it can seamlessly fit into the design of our app. Surely this is the easiest and quickest way to accomplish the integration. You don't need to worry about APIs or other complex integration tasks and can focus on designing the remainder of your app - for instance, leading your customer through the creation of some form of digital content using the photos stored on their mobile device.

However, choosing this simple integration strategy has its disadvantages. When users click on the Cloud Print Button, they exit your mobile app and enter Peecho’s Checkout process- which in itself is not a bad thing- but it is a pre-defined process beyond your scope of control. If this presents a problem for your specific purpose, you’ll need to establish an integration at a deeper level. Luckily, Peecho provides you with the means to do so!

Native Integration of Peecho’s Cloud Print Button

The technical architecture of Peecho’s Cloud Print Button enables you to set up a native integration of the checkout process into your mobile app. This is best explained with an example. Suppose you want to develop an app which allows users to select a PDF from their mobile device and have it printed and delivered to a certain address. Let's assume that the user knows the number of pages and the dimensions of the PDF. Knowing the document’s characteristics, you can invoke Peecho’s checkout API and ask the API to suggest a list of matching print products. Users select the print product (hardcover, glossy paper, etc.) of their liking and are subsequently presented with a (native) form to fill out their address details. Since you're building a native app, you can use the Contacts API to let the user select an address from their contacts database. Peecho’s checkout API is built in such a way that the information you're collecting during this process is added to a temporary order using a simple JSON data flow. Having done this, you present your users with a confirmation page and proceed to the payment page.

After a successful payment, you can thank your customers for their order and invite them to share their Peecho experience with their friends on social media.

This approach allows you to remain in control of your own app, collect and store data incrementally in Peecho’s checkout and use as many native APIs as you like while presenting them in a consistent design. At MobPri, we have implemented this example using native Android code in the PdfPrint app, which is now available on Google Play. Alternatively, the same level of integration could have been attained using Titanium Appcelerator. In fact, this would probably be easier for the programmer because Titanium Mobile apps are written in JavaScript, which has better out of the box JSON support when compared to Android. This would greatly simplify the behind-the-scenes JSON communication between the mobile app and the Peecho checkout.

Which approach would work best for you? Share your thoughts with us in the comments and contact us if you’d like more information about integrating your app with Peecho’s API.