MattSynaptic commented on issue #689:
URL: 
https://github.com/apache/cordova-plugin-camera/issues/689#issuecomment-884369882


   > Hey,
   > 
   > I fixed by changed some code in CameraLauncher.java file but it's not 
proper as i did hardcoded there.
   > 
   > in `public void takePicture(int returnType, int encodingType)` method has 
following code:
   > 
   > ```
   > this.imageUri = new 
CordovaUri(FileProvider.getUriForFile(cordova.getActivity(),
   >                 applicationId + ".provider",
   >                 photo));
   > ```
   > 
   > here somehow in ionic 5 `applicationId` got not found and throwing that 
error.
   > 
   > so for now i hard coded like following:
   > 
   > ```
   > this.imageUri = new 
CordovaUri(FileProvider.getUriForFile(cordova.getActivity(),
   >                  "my.application.packgeID.provider", // 
my.application.packgeID is my app package id 
   >                 photo));
   > ```
   > 
   > and bingo it's working.
   > 
   > But we need proper solution to grab package id there it's not dynamic for 
now as i don't know it's ionic 5 issue or plugin code issue till now. :)
   > 
   > Thank you
   
   This worked for me but I figured out if you do this it will resolve it 
without having to hard-code the applicationId in:
   
   ```
       public boolean execute(String action, JSONArray args, CallbackContext 
callbackContext) throws JSONException {
           this.callbackContext = callbackContext;
   
           //Adding an API to CoreAndroid to get the BuildConfigValue
           //This allows us to not make this a breaking change to embedding
           // BROKEN: this.applicationId = (String) 
BuildHelper.getBuildConfigValue(cordova.getActivity(), "APPLICATION_ID");
           // BROKEN: this.applicationId = 
preferences.getString("applicationId", this.applicationId);
           this.applicationId = cordova.getActivity().getPackageName(); // ADDED
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to