The root problem I have is that the Android Cordova Camera is crashing on some devices. It works on the Appery tester but fails in the publish application for these devices.
I think I have traced the problem to the the Crodova Plugin writing a temp file of the photo, but the app hasn't requested permission for writing to external storage.
I am trying to determine if I have a permission and then request permission manually to write to external storage.
I got this from developer.Adroid.com but the system crashes when it hits ContextCompat and ActivityCompat.
How do I solve this problem.
// Here, thisActivity is the current activity
if (ContextCompat.checkSelfPermission(thisActivity,
Manifest.permission.READ_CONTACTS)
!= PackageManager.PERMISSION_GRANTED) {
// Permission is not granted
// Should we show an explanation?
if (ActivityCompat.shouldShowRequestPermissionRationale(thisActivity,
Manifest.permission.READ_CONTACTS)) {
// Show an explanation to the user *asynchronously* -- don't block
// this thread waiting for the user's response! After the user
// sees the explanation, try again to request the permission.
} else {
// No explanation needed; request the permission
ActivityCompat.requestPermissions(thisActivity,
new String[]{Manifest.permission.READ_CONTACTS},
MY_PERMISSIONS_REQUEST_READ_CONTACTS);
// MY_PERMISSIONS_REQUEST_READ_CONTACTS is an
// app-defined int constant. The callback method gets the
// result of the request.
}
} else {
// Permission has already been granted
}
-
Hello Jackson,
Could you please clarify, what libraries version do you use there? What devices have such an error? -
-
- view 12 more comments
-
-
-
-
-
-
-
-
-
-
-
-
-
Hello,
Yes, please check it from your side and resend -
-
I just did.
-
-
-
-
Could you please create a brand new simple app with the only one function - camera service, to check it's work on your device?
Your project has custom plugins and changed sources, which might break the app. Please test that functionality on the clear app to find out the issue.- view 11 more comments
-
-
-
-
-
-
-
-
-
-
-
-
As I said earlier the app works fine on multiple devices. Even Android 8.0 devices.
I'll remove the mapping to be certain. And republish the app.
Currently the app only calls the camera service. Once you accept the picture from the camera service the app crashes.
It works on the tester and it works on Samsung Galaxy's 7-9 have been tested.
It does not work on the LG ThinQ 7 Android 8.0. -
-
Here is a video link of the Updated App with no mapping - Just a single call to the camera service - crashing on the LG ThinQ 7.
https://youtu.be/wWIrevfDlNY -
-
-
-
Hello Jackson,
We couldn't reproduce this issue on any other devices, looks like it is related to this specific model, perhaps, some conflict with Cordova. We passed this information to our development team and they are investigating it, we will get back to you with the update as soon as have any news.-
Thanks. It is good to hear that so far only one device is being affected by it. I'll await your update.
-
-
Also, that issue might be related to only your device (the same model, but another device might work).
Please check on the Cordova forum the same issue with the camera and your device model. If there is no information about it - it means the issue exactly in your device.
Also, please reboot the device and try again - it might solve the issue. If not - please provide us with the locked log from Android Studio when it crashes. -
-
-
-