Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crop is not working when I click Image from camera In Android 11 #7

Closed
akkie2106 opened this issue Dec 1, 2020 · 17 comments · Fixed by #10
Closed

Crop is not working when I click Image from camera In Android 11 #7

akkie2106 opened this issue Dec 1, 2020 · 17 comments · Fixed by #10
Assignees
Milestone

Comments

@akkie2106
Copy link

getting Null in intent data while clicking the image from the camera in Android 11
below in data i'm getting null in intent data
@OverRide
@SuppressLint("NewApi")
protected void onActivityResult(int requestCode, int resultCode, Intent data) {

    // handle result of pick image chooser
    super.onActivityResult(requestCode, resultCode, data);
    if (requestCode == CropImage.PICK_IMAGE_CHOOSER_REQUEST_CODE) {
        if (resultCode == Activity.RESULT_CANCELED) {
            // User cancelled the picker. We don't have anything to crop
            setResultCancel();

        }

        if (resultCode == Activity.RESULT_OK) {
            mCropImageUri = CropImage.getPickImageResultUri(this, data);
            savedState.putString("mCropImageUri", mCropImageUri.toString());

            // For API >= 23 we need to check specifically that we have permissions to read external
            // storage.
            if (CropImage.isReadExternalStoragePermissionsRequired(this, mCropImageUri)) {
                // request permissions and handle the result in onRequestPermissionsResult()
                requestPermissions(
                        new String[]{Manifest.permission.READ_EXTERNAL_STORAGE},
                        CropImage.PICK_IMAGE_PERMISSIONS_REQUEST_CODE);
            } else {
                // no permissions required or already grunted, can start crop image activity
                mCropImageView.setImageUriAsync(mCropImageUri);
            }
        }
    } else {
        Toast.makeText(CropImageActivity.this, "Pressed Back", Toast.LENGTH_SHORT).show();
        finish();

    }

}
@akkie2106
Copy link
Author

@Canato it's from camera otherwise it is working fine with other apps like Files And photos
I'm getting null in intent data while clicking the image from the camera on the Android 11 device.

@akkie2106 akkie2106 changed the title Crop is working when I click Image from camera In Android 11 Crop is not working when I click Image from camera In Android 11 Dec 1, 2020
@Canato
Copy link
Member

Canato commented Dec 1, 2020

Thanks @akkie2106 now that I have more information I can confirm, this is related to #3
Until this issue is done, we will not have a fix for it.

I'm working on the issue to have a proper fix soon.

@Canato Canato added bug labels Dec 1, 2020
@Canato Canato added this to the version_1.1.0 milestone Dec 1, 2020
@Canato Canato self-assigned this Dec 1, 2020
@akkie2106
Copy link
Author

Thanks @akkie2106 now that I have more information I can confirm, this is related to #3
Until this issue is done, we will not have a fix for it.

I'm working on the issue to have a proper fix soon.

Thank you @Canato

@akkie2106
Copy link
Author

@Canato is there any update about the issue that I have raised

@Canato
Copy link
Member

Canato commented Dec 4, 2020

When #3 is fixed and we open a PR for this we will release a new version with the fix, until there people are working on the solution. If you already spot, please open a PR

@akkie2106
Copy link
Author

oke I found a solution for this open directly camera for clicking image and then directly pass URI for cropping.
image
image
@Canato @ravindu1024 it is working

@akkie2106
Copy link
Author

If you find the solution to #3, please let me know
@Canato @ravindu1024
Thank you

@akkie2106
Copy link
Author

@akkie2106
Where does that code go?

There is a thing in Android studio You can simply use i.e Debugging use it You will find
@Harld123

@Harld123
Copy link

Harld123 commented Dec 5, 2020

@akkie2106 @ravindu1024

is there a way to not show the camera option without removing the following from the Manifest file:

<queries> <intent> <action android:name="android.media.action.IMAGE_CAPTURE" /> </intent> </queries>

@akkie2106
Copy link
Author

@Harld123 go through the cropper code you'll find definitely

either remove camera intents

@Canato Canato linked a pull request Dec 6, 2020 that will close this issue
@SaltyBoi31
Copy link

oke I found a solution for this open directly camera for clicking image and then directly pass URI for cropping. image image @Canato @ravindu1024 it is working

@akkie2106 can you please send your java file? I'm having trouble implementing what you have said.

@akkie2106
Copy link
Author

akkie2106 commented Jan 2, 2022 via email

@SaltyBoi31
Copy link

Hi team, I'll send tomorrow because currently I'm on vacation.

On Sun, 2 Jan, 2022, 14:17 SaltyBoi31, @.> wrote: oke I found a solution for this open directly camera for clicking image and then directly pass URI for cropping. [image: image] https://user-images.githubusercontent.com/67181037/101163543-be710800-3659-11eb-88d6-353812a50e95.png [image: image] https://user-images.githubusercontent.com/67181037/101163628-dfd1f400-3659-11eb-8e4e-23d41e35cbe4.png @Canato https://github.com/Canato @ravindu1024 https://github.com/ravindu1024 it is working @akkie2106 https://github.com/akkie2106 can you please send your java file? I'm having trouble implementing what you have said. — Reply to this email directly, view it on GitHub <#7 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQART3KKFNZ3U74AFAANQ7TUUAGJBANCNFSM4UI5IGJQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub. You are receiving this because you were mentioned.Message ID: @.>

@akkie2106 Good day! Is it now possible for you to send the java file?

@rafibr
Copy link

rafibr commented Jan 14, 2022

Hi team, I'll send tomorrow because currently I'm on vacation.

On Sun, 2 Jan, 2022, 14:17 SaltyBoi31, @.> wrote: oke I found a solution for this open directly camera for clicking image and then directly pass URI for cropping. [image: image] https://user-images.githubusercontent.com/67181037/101163543-be710800-3659-11eb-88d6-353812a50e95.png [image: image] https://user-images.githubusercontent.com/67181037/101163628-dfd1f400-3659-11eb-8e4e-23d41e35cbe4.png @Canato https://github.com/Canato @ravindu1024 https://github.com/ravindu1024 it is working @akkie2106 https://github.com/akkie2106 can you please send your java file? I'm having trouble implementing what you have said. — Reply to this email directly, view it on GitHub <#7 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQART3KKFNZ3U74AFAANQ7TUUAGJBANCNFSM4UI5IGJQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub. You are receiving this because you were mentioned.Message ID: @.>

@akkie2106 Hi, can you send the java file? i have a problem implement this, Thank you

@akkie2106
Copy link
Author

akkie2106 commented Jan 20, 2022 via email

@SaltyBoi31
Copy link

Sure, no problem. Please find the whole project https://drive.google.com/file/d/1-VBQjU85pHizYtAzb-Oyh8xpqnEDGOK-/view?usp=drivesdk On Fri, 14 Jan, 2022, 13:42 Muhammad Rafi B.R., @.> wrote:

Hi team, I'll send tomorrow because currently I'm on vacation. … <#m_-8663672560202519397_> On Sun, 2 Jan, 2022, 14:17 SaltyBoi31, @.
> wrote: oke I found a solution for this open directly camera for clicking image and then directly pass URI for cropping. [image: image] https://user-images.githubusercontent.com/67181037/101163543-be710800-3659-11eb-88d6-353812a50e95.png https://user-images.githubusercontent.com/67181037/101163543-be710800-3659-11eb-88d6-353812a50e95.png [image: image] https://user-images.githubusercontent.com/67181037/101163628-dfd1f400-3659-11eb-8e4e-23d41e35cbe4.png https://user-images.githubusercontent.com/67181037/101163628-dfd1f400-3659-11eb-8e4e-23d41e35cbe4.png @Canato https://github.com/Canato https://github.com/Canato https://github.com/Canato @ravindu1024 https://github.com/ravindu1024 https://github.com/ravindu1024 https://github.com/ravindu1024 it is working @akkie2106 https://github.com/akkie2106 https://github.com/akkie2106 https://github.com/akkie2106 can you please send your java file? I'm having trouble implementing what you have said. — Reply to this email directly, view it on GitHub <#7 (comment) <#7 (comment)>>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQART3KKFNZ3U74AFAANQ7TUUAGJBANCNFSM4UI5IGJQ https://github.com/notifications/unsubscribe-auth/AQART3KKFNZ3U74AFAANQ7TUUAGJBANCNFSM4UI5IGJQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub. You are receiving this because you were mentioned.Message ID: @.
> @akkie2106 https://github.com/akkie2106 Hi, can you send the java file? i have a problem implement this, Thank you — Reply to this email directly, view it on GitHub <#7 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQART3OUAJXS5U3NWJBZ5SLUV7LIRANCNFSM4UI5IGJQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub. You are receiving this because you were mentioned.Message ID: @.
**>

Thank you! I had to do a whole lot of other things to fix my issue, but your code helped a lot.

@akkie2106
Copy link
Author

akkie2106 commented Jan 27, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants