Closed rezafaraji93 closed 4 months ago
Hi @rezafaraji93 and thank you for your feedback,
Do you have declared a FileProvider
in your app's AndroidManifest.xml
?
If so, Crisp SDK already declares one for attachments upload and only one could be declared per app. So what you could do is merge both into yours as below.
AndroidManifest.xml
<!-- Adds the the Crisp SDK upload authority -->
<provider android:name="androidx.core.content.FileProvider"
android:authorities="my.app.fileprovider;${applicationId}.im.crisp.client.uploadfileprovider"
android:exported="false"
android:grantUriPermissions="true"
tools:replace="android:authorities">
<meta-data android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_paths"
tools:replace="android:resource" />
</provider>
res/xml/file_paths.xml
<paths>
<files-path name="files" path="files/" />
<cache-path name="cache" path="cache/" />
<!-- Declares the Crisp SDK attachments path into your app's folder -->
<files-path name="crisp_sdk_attachments" path="im.crisp.client/attachments/" />
</paths>
Thanks for your reply
I added the provider to the Manifest and now I am getting this error:
java.lang.SecurityException: Permission Denial: starting Intent { act=android.media.action.IMAGE_CAPTURE flg=0x3 cmp=com.android.camera2/com.android.camera.CaptureActivity clip={text/uri-list hasLabel(0) {U(content)}} (has extras) } from ProcessRecord{ca7a265 7757:cash.bit24/u0a190} (pid=7757, uid=10190) with revoked permission android.permission.CAMERA
I manually allowed the camera permission from settings and it didn't crash. Then, I tried to send the captured image, but after clicking on the tick icon to send, nothing happened. So now there are two problems, first, camera permission problem, Second, send capture image didn't work.
I suppose you're declaring the android.permission.CAMERA
permission in your app's AndroidManifest.xml
right?
In this specific case, I am able to reproduce the crash and I found some clarification about using both MediaStore.ACTION_IMAGE_CAPTURE
intent, which we are to avoid adding an unnecessary permission, and the android.permission.CAMERA
permission, which is revoked by default on Android M and later.
With this combination, even if the MediaStore.ACTION_IMAGE_CAPTURE
intent does not need the permission, because it's the app targeted by the intent which needs it, it raises a SecurityException
anyway...
sources:
So if the android.permission.CAMERA
permission is mandatory for your app, we'll need to add a permission check in the Crisp SDK to avoid the crash. If not, you can simply remove it from your app's AndroidManifest.xml
.
However, I did not reproduced the captured image not sent.
See the video below where I firstly tried to take a picture without the permission, then granted it and retried successfully.
Did you do something else? Did you added correctly our authority and path? Do you have an error snackbar at the bottom or more logs (there should be some with an UPLOAD
tag) to provide me?
https://github.com/crisp-im/crisp-sdk-android/assets/2175246/024f3754-4708-4632-af5d-7f2b6e7d18fd
Yes the camera permission is mandatory in our application. When will this be fixed?
Would you please let me know when are you planning to update the sdk?
Hi @rezafaraji93,
I'm currently working on fixing this issue ;) After that, I have a feature to finish and another one to implement before considering releasing a new beta version of the SDK, so don't expect it before the end of next week.
Hi @rezafaraji93,
As promised, the new 2.0.1beta2
fixing your issue has just been released, I close this issue
We are facing this error: java.lang.IllegalArgumentException - Couldn't find meta-data for provider with authority package.name.im.crisp.client.uploadfileprovider crisp version: v2.0.0beta1