Skip to content

Instantly share code, notes, and snippets.

@bradtheappguy
Created June 25, 2013 18:32
Show Gist options
  • Save bradtheappguy/5861045 to your computer and use it in GitHub Desktop.
Save bradtheappguy/5861045 to your computer and use it in GitHub Desktop.
RadiumOne PhotoEffects SDK Android Integration

Introduction

The Android R1 Photo Effects SDK allows developers to include a suite of image effects in their applications.

The zip file includes the R1 Photo Effects SDK and an SDK demo app for installation reference.

Eclipse Demo Installation

1. Verify that the latest android tools have been installed in the SDK Manager.

  • The SDK Manager can be accessed through the window menu option in eclipse
  • Installation requires version 22 of the Android SDK Tools
  • Installation requires version 17 of the Android SDK Platform-tools
  • Installation requires version 17 of the Android SDK Build-tools
  • SDK requires Android version 2.3 to run

2. Verify that eclipse is up to date.

  • Updates can be downloaded and installed from the help menu tab

3. Import the Photo Effects SDK.

  • Select File
  • Select Import

Alt text

  • Select Android
  • Select Existing Android Code Into Workspace
  • Select Next

Alt text

  • Select Browse and locate the R1 Photo SDK [root] folder
  • Verify that both r1-effects-sdk-library and sdk-demo are checked
  • Select Finish

Alt text

4. Disable automatic builds.

  • Select the r1-effects-sdk-library project in the Package Explorer
  • Select the Project menu tab
  • Deselect Build Automatically

Alt text

5. Clean the SDK Project.

  • Select the r1-effects-sdk-library project in the Package Explorer
  • Select the Project menu tab
  • Select Clean

Alt text

  • Select Clean projects selected below
  • Verify that only the SDK project is checked
  • Deselect Start a build immediately
  • Select OK

Alt text

6. Run the Demo Project.

  • Right click the demo project in the Package Explorer
  • Select Run As
  • Select 1 Android Application
  • The demo will build to a connected android device

Alt text

Eclipse Custom Installation By Example

1. Configure the AndroidManifest.xml.

  • Double click the AndroidManifest.xml file under the demo project in the Package Explorer
  • Select the farthest tab to the right below the open window to access the XML
// The following permissions must be inside of the manifest tag
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="com.android.vending.BILLING" />
<uses-permission android:name="android.permission.DOWNLOAD_WITHOUT_NOTIFICATION" />

// The following sdk reference must be inside of the manifest tag
<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="17"/>

// The following feature must be inside of the manifest tag
<uses-feature android:glEsVersion="0x00020000" android:required="true"/>   
   
// The following activities must be inside of the application tag  
<activity android:name="com.radiumone.effects_sdk.CropImage" android:configChanges="orientation|keyboardHidden" android:screenOrientation="portrait" />
<activity android:name="com.radiumone.effects_sdk.EffectsChooserActivity" android:configChanges="orientation|keyboardHidden" android:launchMode="singleTop" android:screenOrientation="portrait" />
<activity android:name="com.radiumone.effects_sdk.EffectsStoreActivity" android:configChanges="orientation|keyboardHidden" android:screenOrientation="portrait" />

// The following service must be inside of the application tag
<service android:name="com.radiumone.effects_sdk.FilterDownloadManager"/>  
  
// The following heap and hardware properties must be inside of the application tag
android:largeHeap="true"
android:hardwareAccelerated="false"

2. Initialize the SDK in activity onCreate.

  • Inside of the onCreate function for the activity that will call the R1 Photo Effects SDK add the following line for SDK initialization
  • The R1 Photo Effects app token and Google Play app signature are required
R1PhotoEffectsSDK.getManager().init(this, "<Your R1 SDK APP TOKEN>", "<Your App Signature>");

3. Send an image to the R1 Photo SDK.

  • Add the following to your fragment, where imagebitmap is the photo bitmap to pass to the SDK. Use "this" for getActivity() when running directly from an activity.
R1PhotoEffectsSDK r1sdk = R1PhotoEffectsSDK.getManager();
r1sdk.launchPhotoEffects(
getActivity(),
imagebitmap,
true,
	new R1PhotoEffectsSDK.PhotoEffectsListener() {			
		@Override
		public void onEffectsComplete(Bitmap output) {
			if( null == output ){
		    		return;
		    	}
			// do something with output	
    		}
    		@Override
    		public void onEffectsCanceled() {
    			// user canceled					
	    	}
	} 
);

Paid Effects Configuration

Developers can enable paid packs for their application through Google Play. To add paid packs, contact your account manager for more information.

1. Sign in to the Google Play Developer Console.

2. Add each pack as an in-app product.

  • Select the + Add new product button
  • Select the Managed Product tab
  • Copy/paste the product ID into the form and select Continue
  • Copy/paste the product name into the title field
  • Copy/paste the product description into the description field
  • Set a price (we suggest 99 cents)
  • Select the Auto-convert prices now button
  • Select the Save button
  • Select activate in the drop down menu to the right of the save button
  • Repeat for each additional paid package
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment