API�ĵ�
CamScanner OpenAPI for Android
Help Document
3rd party must submit following information to CamScanner:
Company name (Required):
Company description (optional):
Company website (Required):
3rd party App title and description (Required):
After certification, CamScanner will provide SDK package for Android:
1.
Android OpenAPI:
Package includes:
1. Scan component installation package (.apk), which is required to be installed on device for 3rd party app call scan component.
2. Integration Guide: Interface definition and sample code.
Android
SDK integration prerequisites:
Android OS��Android 2.x and above
Camera��Camera with Auto Focus and 2MP+
Image format: *.jpg
Intent
Action ��com.intsig.camscanner.ACTION_SCAN
Request Parameters��
|
Type |
Requires |
Description |
Intent.EXTRA_STREAM |
Uri |
true |
The Uri of source image |
scanned_image |
String |
true |
A path which 3rd party App provides to save the scanned image |
|
String |
optional |
A path which 3rd party App provides to save the pdf generated by CamScanner |
org_image |
String |
optional |
A path which 3rd party App provides to save the original image |
EXAMPLE��
// Intent intent = new Intent("com.intsig.camscanner.ACTION_SCAN"); Uri uri
= Uri.fromFile(new File("/sdcard/source.jpg")); //Or content uri
picked from gallery intent.putExtra(Intent.EXTRA_STREAM, uri); intent.putExtra("scanned_image", ��/sdcard/scanned.jpg��); intent.putExtra("pdf_path", ��/sdcard/processed.jpg��); intent.putExtra("org_image", ��/sdcard/org.jpg��); startActivityForResult(intent, REQUEST_CODE); |
3rd party App can get the result in the function of onActivityResult(int requestCode, int resultCode, Intent data) in Activity. The returning values are following:
1. resultCode
This value is following:
Activity.RESULT_OK: represents CamScanner has accepted your request and processed the image, and you can check the responseCode to decide whether CamScanner save the processed file in the specified path successfully;
Activity.RESULT_FIRST_USER: represents CamScanner has denied your request and will not return you the processed file. Please check responseCode for details.
Activity.RESULT_CANCELD: represents the user has canceled the scanning process.
2. responseCode
This value is following:
6000: The returned result is ok.
4004: Invalid App package name. Please call CamScanner OpenAPI by startActivityForResult().
4006: The source image is invalid, such as the image file does not exist, broken, or not JPEG format.
5003: The 3rd party App certification is expired.
5006: The enhance mode which user choose is not authorized for the 3rd party App
5007: The request times has reached the limitation in one day.
7001: Can��t save the scanned image. The file is invalid, such as file not exists or no enough space to save the image.
7002: CamScanner can��t save the pdf document. The file is invalid, such as file not exists or no enough space to save the image.
7003: CamScanner can��t save the original image. The file is invalid, such as file not exists or no enough space to save the image.
EXAMPLE��
void onActivityResult(int requestCode, int resultCode, Intent data){ If(requestCode == REQUEST_CODE ){ int
responseCode=data.getIntExtra(��RESPONSE_CODE��,-1); If(resultCode==Activity.RESULT_OK){ //Success }else if(resultCode == Activity.RESULT_FIREST_USER){ //Fail }else if(resultCode==Activity.RESULT_CANCELED){ // User canceled } } } |