Getting Started for Eclipse IDE

Add Gooten SDK to your project

  1. Clone Gooten SDK project from this repository

  2. Import Gooten SDK project File -> Import -> General -> Existing Projects into Workspace*

  3. Mark Gooten SDK as library project Select Gooten SDK project -> Properties -> Android -> Make sure that “Is Library” is ticked

  4. Add Gooten SDK dependencies Libraries will have to be added manually when developing with Eclipse
    (In Android Studio, these dependencies are automatically resolved by Gradle dependency management mechanism).

    To make your life easier we have bundled these libraries together. You can download this archive and extract the files to the libs folder of the Gooten SDK.

    Android v4 Support Library is also required. Chances are that you already have this library included in your project. If not, you can find instructions about including support libraries on this link.

  5. Add Gooten SDK library to your project Select your project -> Properties -> Android -> Add… -> Choose Gooten SDK library

AndroidManifest Configuration

In your project, open **your_app AndroidManifest.xml** and configure it accordingly:
  1. Set Android SDK version

    Gooten SDK supports Android 4.0+ (API level 14 and higher). The <uses-sdk> node of your manifest should look like this:

    <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="23" />
  2. Permissions

    Add fallowing permissions:

    	
     <!-- Begin Gooten SDK -->
     <uses-permission android:name="android.permission.INTERNET" />
     <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
     <uses-permission android:name="android.permission.GET_ACCOUNTS" />
     <uses-permission android:name="android.permission.USE_CREDENTIALS" />
     <uses-permission android:name="android.permission.READ_CONTACTS" />
     <!-- End Gooten SDK -->
    	
     <!-- Begin PayPal -->
     <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
     <!-- End PayPal -->
     
  3. Activities and Services

    Add following activities:

    	
    <!-- Begin Gooten SDK -->
    <activity
        android:name="print.io.PIOActivity"
        android:screenOrientation="portrait" />
    <activity
        android:name="print.io.ActivityOptionBackground"
        android:screenOrientation="portrait"
        android:windowSoftInputMode="stateHidden" />
    <activity
        android:name="print.io.ActivityCountry"
        android:screenOrientation="portrait"
        android:windowSoftInputMode="stateHidden" />
    <activity
        android:name="print.io.ActivityCurrency"
        android:screenOrientation="portrait"
        android:windowSoftInputMode="stateHidden" />
    <activity
        android:name="print.io.ActivityProducts"
        android:screenOrientation="portrait"
        android:windowSoftInputMode="adjustResize|stateHidden" />
    <activity
        android:name="print.io.ActivityProductsV2"
        android:screenOrientation="portrait"
        android:windowSoftInputMode="adjustResize|stateHidden" />
    <activity
        android:name="print.io.ActivityProductDetails"
        android:screenOrientation="portrait" />
    <activity
        android:name="print.io.ActivityProductDetailsV2"
        android:screenOrientation="portrait" />
    <activity
        android:name="print.io.ActivitySelectPhotos"
        android:screenOrientation="portrait" />
    <activity
        android:name="print.io.ActivityCustomizeProduct"
        android:screenOrientation="portrait"
        android:windowSoftInputMode="adjustResize" />
    <activity
        android:name="print.io.ActivityCustomizePhotobook"
        android:screenOrientation="landscape"
        android:windowSoftInputMode="adjustResize" />
    <activity
        android:name="print.io.ActivityProductOptions"
        android:screenOrientation="portrait" />
    <activity
        android:name="print.io.ActivityCustomizeList"
        android:screenOrientation="portrait"
        android:windowSoftInputMode="stateHidden" />
    <activity
        android:name="print.io.ActivityShoppingCart"
        android:screenOrientation="portrait"
        android:windowSoftInputMode="stateHidden|adjustResize" />
    <activity
        android:name="print.io.ActivityPaymentMethod"
        android:screenOrientation="portrait"
        android:windowSoftInputMode="adjustResize|stateUnchanged" />
    <activity
        android:name="print.io.ActivityChooseShippingAddress"
        android:screenOrientation="portrait" />
    <activity
        android:name="print.io.ActivityAddAddress"
        android:screenOrientation="portrait"
        android:windowSoftInputMode="adjustResize" />
    <activity
        android:name="print.io.ActivityShipmentReview"
        android:screenOrientation="portrait"
        android:windowSoftInputMode="stateHidden" />
    <activity
        android:name="print.io.ActivityOrderCompleted"
        android:screenOrientation="portrait"
        android:windowSoftInputMode="stateHidden" />
    <activity
        android:name="print.io.photosource.impl.facebook.Facebook"
        android:screenOrientation="portrait" />
    <activity
        android:name="print.io.photosource.impl.instagram.Instagram"
        android:screenOrientation="portrait" />
    <activity
        android:name="print.io.photosource.impl.flickr.Flickr"
        android:screenOrientation="portrait" />
    <activity
        android:name="print.io.photosource.impl.dropbox.Dropbox"
        android:screenOrientation="portrait" />
    <activity
        android:name="print.io.ActivityAbout"
        android:screenOrientation="portrait" />
    <activity
        android:name="print.io.ActivityHowItWorks"
        android:screenOrientation="portrait" />
    <activity
        android:name="print.io.ActivityQualityGuarantee"
        android:screenOrientation="portrait" />
    <activity
        android:name="com.facebook.FacebookActivity"
        android:screenOrientation="portrait" />
    <activity
        android:name="print.io.ActivityOrderDetails"
        android:screenOrientation="portrait" />
    <activity
        android:name="print.io.ActivityOrderStatus"
        android:screenOrientation="portrait" />
    <activity
        android:name="print.io.ActivityPastOrders"
        android:screenOrientation="portrait" />
    <activity
        android:name="print.io.ActivityHelp"
        android:screenOrientation="portrait" />
    <!-- End Gooten SDK -->
    	
    <!-- Begin PayPal -->
    <activity
        android:name="com.paypal.android.sdk.payments.PaymentActivity"
        android:screenOrientation="portrait" />
    <activity
        android:name="com.paypal.android.sdk.payments.PaymentMethodActivity"
        android:screenOrientation="portrait" />
    <activity
        android:name="com.paypal.android.sdk.payments.PaymentConfirmActivity"
        android:screenOrientation="portrait" />
    <activity
        android:name="com.paypal.android.sdk.payments.LoginActivity"
        android:screenOrientation="portrait" />
    <activity
        android:name="com.paypal.android.sdk.payments.PayPalFuturePaymentActivity"
        android:screenOrientation="portrait" />
    <activity android:name="com.paypal.android.sdk.payments.FuturePaymentConsentActivity"
        android:screenOrientation="portrait" />
    <activity
        android:name="com.paypal.android.sdk.payments.FuturePaymentInfoActivity"
        android:screenOrientation="portrait" />
    <activity
        android:name="com.paypal.android.sdk.payments.PayPalProfileSharingActivity"
        android:screenOrientation="portrait" />
    <activity
        android:name="com.paypal.android.sdk.payments.ProfileSharingConsentActivity"
        android:screenOrientation="portrait" />
    <service
        android:name="com.paypal.android.sdk.payments.PayPalService"
        android:exported="false" />
    <!-- End PayPal -->
    
  4. Application element

    Important: android:largeHeap="true" attribute is required to be set on <application\> element.

Copy Fonts

Create `fonts` folder in your project's `assets` dir. Then copy fonts from [this](https://www.dropbox.com/s/6s60ldvxlo6q6ta/fonts.zip?dl=1) archive to `fonts` folder.

Quick Launch Code

Here is example for launching Gooten SDK with minimal configuration.

// Create PIOConfig object which will be used to configure SDK
PIOConfig config = new PIOConfig();

// Mandatory config - set API key provided for every partner
config.setRecipeID("<INSERT YOUR KEY HERE>");

// Optional config - set available photo sources
config.setPhotoSources(Arrays.asList((PhotoSource)
	new PhonePhotoSource()
));

try {
	// Set configuration object and start Gooten SDK
	PIO.setConfig(this, config);
	PIO.start(this);
} catch (PIOException e) {
	e.printStackTrace();
}

Quick Launch Result

After SDK has launches successfully (using “Quick Launch” code from above) you should see screen similar as on following screenshot:

Successfull launch screenshot

Optional SDK Configuration

  • Using defaul products settings – If you would like to use all available products and SKUs with default pricing you can configure SDK by setting following property of PIOConfig object:

    config.setAllProductsAndVariants(true)
  • Testing orders – If you would like to test placing orders without paying real money you can configure SDK by setting following property of PIOConfig object:

    config.setOrderTesting(true)
  • Passing in images – SDK allows you to set predefined list of images that will be available to the user. To do so you will need to set list of URIs of predefined images and set/add PreselectedPhotoSource to the list of available photo sources.

        // Set URIs to predefined images
      config.setImageUris(Arrays.asList("<URI to image 1>", "<URI to image 2>"));
        
      // Set Preselected photo source as single photo source. Preselected photo source will only show photos that were passed in using PIOConfig#setImageUris method.
      config.setPhotoSources(Arrays.asList((PhotoSource)
      	new PreselectedPhotoSource()
      ));