cymera

Developer

cymera API

Use our API whenever you need to use Cymera to take and edit photos fast and easy Now you can connect and use Cymera's features from external apps on each OS.

Use the Intents and Intent Filters included on Android to call out Cymera and use its shooting function on external apps. You can select either Cymera custom type or Broadcast type to proceed

Cymera custom type

<Action>

com.cyworld.camera.action.IMAGE_CAPTURE

<Input Parameters>

Input Parameters
Parameter name Type Mandatory Description Example
output_dir_name String O output folder name My app
output_pic_width int (px) X output image width 600
output_pic_height int (px) X output image height 600
crop boolean X image scale type
- true : crop with requested (center)
- false : resize with requested size
true

* Output image will be made based on original image when optional parameters are not specified.

<Output Parameters>

Output Parameters
Parameter name Type Description
result_code int result value
picture_uri Uri output Uri information

<Result code>

Result code
Code Description
0 output image with requested size(width & height)
1 output image with requested width
2 output image with requested height

<Sample Code>

Sample code
(1) Creating intent
Intent intent = new Intent();
intent.addFlags( Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET )
ComponentName compName = new  ComponentName( "com.cyworld.camera" , "com.cyworld.cymera.CameraMain" );
intent.setComponent(compName);
intent.setAction( "com.cyworld.camera.action.IMAGE_CAPTURE" );
intent.putExtra( "output_dir_name" , "My app" );
intent.putExtra( "output_pic_width" , 640 );
intent.putExtra( "output_pic_height" , 480 );
intent.putExtra( “crop”, true );
startActivityForResult(intent, REQ_CODE);
								
(2) Getting result of creating intent
//Activity's onActivityResult() method
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
	if (resultCode == RESULT_OK) {		
		switch (requestCode) {
	    		case REQ_CODE:
				if (data != null) {
          				int rcode = data.getIntExtra( “result_code” );	// result code
					Uri uri = data.getParcelableExtra( “picture_uri” );// result Uri
				}
			break;
	  	}
	} else if (resultCode == RESULT_CANCEL) {
		switch (requestCode) {
			case REQ_CODE:
				// process for cancel
			break;
		}
	}
}

Broadcast

Designate and call out an Action and Mime type from below and Cymera's shooting function will be added on the application chooser.

<Action>

Intent.ACTION_SEND

Intent.ACTION_VIEW

* Select 1 from above

<Mime type>

“image/jpg”

“image/png”

“image/*"

* Select 1 from above

<Sample Code>

sample code
(1) Creatiing intent 1
Intent intent = new Intent();
intent.setAction(Intent.ACTION_SEND);
intent.setType("image/png");
startActivity(intent);
(2) Creatiing intent 2
Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
intent.setType("image/*");
startActivity(intent);
Questions about the API? : help@cymera.com