From e5a80d4dd85c9a95f2cbfd9b75e3cc40fc0c88e5 Mon Sep 17 00:00:00 2001 From: Abhishek Tomar <6933841+ImAbhishekTomar@users.noreply.github.com> Date: Thu, 16 Mar 2023 15:57:57 +0530 Subject: [PATCH] Illegal Argument Exception with Ionic 6 https://github.com/apache/cordova-plugin-camera/issues/689 --- src/android/CameraLauncher.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/android/CameraLauncher.java b/src/android/CameraLauncher.java index 198c03999..94a9fccba 100644 --- a/src/android/CameraLauncher.java +++ b/src/android/CameraLauncher.java @@ -149,8 +149,14 @@ public boolean execute(String action, JSONArray args, CallbackContext callbackCo //This allows us to not make this a breaking change to embedding this.applicationId = (String) BuildHelper.getBuildConfigValue(cordova.getActivity(), "APPLICATION_ID"); this.applicationId = preferences.getString("applicationId", this.applicationId); - - + + //ISSUE: https://github.com/apache/cordova-plugin-camera/issues/689 + //FIX: Some time Building config class don't have APPLICATION ID and this is showing + //blank on adding this if the application Id is blank then use get activity class to initialize application id + if(this.applicationId=="" || this.applicationId==null){ + this.applicationId=cordova.getActivity().getPackageName(); + } + if (action.equals(TAKE_PICTURE_ACTION)) { this.srcType = CAMERA; this.destType = FILE_URI;