Android Question Launch "Camscanner" from intent ?

jnbarban

Member
Licensed User
Longtime User
Hi , i would like use Camscanner api from my application.
The CamScanner documentation says how call Camscanner from 3rd Party App :

To call camscanner :
B4X:
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”);  (Optionnal)
intent.putExtra("org_image", “/sdcard/org.jpg”); (Optionnal)
startActivityForResult(intent, REQUEST_CODE);


to get the result :
B4X:
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
}
}
}



In my Application i try to do this :
B4X:
Dim AU As MyActivityUtils
Dim In As Intent

In.Initialize("com.intsig.camscanner.ACTION_SCAN","")
In.putExtra("android.intent.extra.STREAM", "file:///sdcard/imgsourceBis.jpg")
In.putExtra("scanned_image", "file:///sdcard/imgsource.jpg")
AU.startActivitywithResult(In)

B4X:
Sub Activity_OnResult(ResultCode As Int, ReturnIntent As Intent)
    Log(ResultCode & " " & ReturnIntent.ExtrasToString)
    If ResultCode = 0 Then Return
    If ReturnIntent.HasExtra("Path") Then
    End If
End Sub


what i doing wrong ?
 
Last edited:

DonManfred

Expert
Licensed User
Longtime User
Upvote 0

jnbarban

Member
Licensed User
Longtime User
1. Please use code tags when posting code!
2. Are you using B4A SDKManager and all Items are uptodate?
3. You are using Android.jar from Api 28 downloaded by the SDKManager?
4. You are using targetSdk 24 or Higher in your Manifest?

https://www.b4x.com/android/forum/threads/android-jar-targetsdkversion-minsdkversion.87610/
and especially:
- 24 - must use FileProvider when sharing files (https://www.b4x.com/android/forum/threads/class-fileprovider-share-files.97865/)

First, sorry for Code tags ( it's ok now ) ;)

- I don't have B4A SDK Manager ( my B4A version are 6.80)
- for android.jar, i use API 17 ( C:\Android\Android\android-sdk\platforms\android-17\android.jar )
 
Upvote 0
Top