Commit Graph

95 Commits

Author SHA1 Message Date
エリス 571f1169fd chore(license): update header formatting (#958) 2026-03-24 13:52:15 +09:00
Manuel Beck dc682b2532 feat(ios): use PHPickerViewController for iOS 14+ (#937)
- Does not need any permissions for reading images
- The PHPickerViewController class is an alternative to UIImagePickerController. PHPickerViewController improves stability and reliability, and includes several benefits to developers and users, such as the following:
- Deferred image loading and recovery UI
- Reliable handling of large and complex assets, like RAW and panoramic images
- User-selectable assets that aren’t available for UIImagePickerController
- Configuration of the picker to display only Live Photos
- Availability of PHLivePhoto objects without library access
- Stricter validations against invalid inputs
- See documentation of PHPickerViewController: https://developer.apple.com/documentation/photosui/phpickerviewcontroller?language=objc
- Added tests for PHPickerViewController in `CameraTest.m`

* Documentation and formatting

- Document `takePicture` and `showCameraPicker` in `CDVCamera.m`
- A pragmas for UIImagePickerControllerDelegate methods and CLLocationManager methods
- Format some long methods declarations to multi-line instead single-line for better readability
- Remove unnecessry `dispatch_async(dispatch_get_main_queue() ...` in `takePicture` before calling `showCameraPicker`. This is already done in `showCameraPicker`.
- Source out code for permission denied alert dialog when accessing the camera or UIImagePickerController on iOS < 14 for picking images

* feat(ios): proper formatting of methods

- Use linux brace style: A brace have to be on a new line for method declarations
- Remove unnecessary whitespaces in method declrations

* doc: readme update

- Better document usage descriptions
- `NSPhotoLibraryUsageDescription` not needed for iOS 14+ when only picking images
- Improve formatting for xml, js
- sourceType `SAVEDPHOTOALBUM` is the same as `PHOTOLIBRARY` on Android and iOS 14+
- Use `PHOTOLIBRARY` as sourceType instead of `SAVEDPHOTOALBUM` in  photo picker example

* Android: Document `SAVEDPHOTOALBUM``

- Make clear that `SAVEDPHOTOALBUM` is the same like `PHOTOLIBRARY` and has only an effect on iOS < 14
- Format code when creating image chooser and document the request code parameter
2026-01-13 08:33:59 +01:00
Norman Breau 8864262022 fix(android): Error propagation when no Camera application is available (#926) 2025-03-20 16:13:02 -03:00
Norman Breau 48c4cdd47f refactor(android): Make WRITE_EXTERNAL_STORAGE optional (#909)
* refactor(android): Rework permission management to make WRITE_EXTERNAL_STORAGE optional

* removed unused getPermissions API

* Proper error if WRITE_EXTERNAL_STORAGE is required but missing the declaration

* removed obsolete hasPermissions API
2024-10-28 15:21:37 -03:00
Norman Breau c208754c08 refactor(android): remove query img usage (#907)
* refactor: remove unnecessary duplicate image checks and queryImgDb usage

* remove unused imageType parameter, because it's a private API anyway
2024-10-28 13:32:35 -03:00
Norman Breau 0d86764b90 refactor(android): replace image path usage with image uris (#906)
* refactor(android): clean up image file path usages

* removed references of image paths in log messages
2024-10-28 12:35:50 -03:00
Norman Breau 2eaa9a3972 fix: return content uris when possible when selecting from gallery (#902) 2024-10-26 00:58:24 -03:00
Norman Breau a672c31efb fix(android): Return data uris as an URI (#910) 2024-10-26 00:58:00 -03:00
Norman Breau 16325102c7 fix(android): Improper serialization of image uri in save instance state (#903) 2024-10-25 13:59:29 -03:00
Norman Breau 36bf8e7331 fix(android): improper cache path construction during image manipulation (#905) 2024-10-25 13:15:59 -03:00
Norman Breau feb7643bc3 fix(android): Use VERSION_CODES instead of hard-coded API literals (#904) 2024-10-25 13:10:05 -03:00
Norman Breau 44480300d9 fix(android): Isolate provider access to a subdirectory (#901) 2024-10-25 13:09:03 -03:00
ravi-yk faa4615ee0 Remove media permissions to make complaint with Android 14 requirements (#889)
Co-authored-by: Ravi Yakasiri <ravi.yakasiri@planonsoftware.com>
2024-10-24 13:38:18 -03:00
エリス 505ccefb4c feat(android)!: Android 13 support (#844)
* feat(android)!: Android 13 support
* refactor(android): simplify getPermissions logic
* feat(android)!: bump cordova-android requirement to >=12.0.0
* feat(android): update saveAlbumPermission to include Android 9 and below use case

---------

Co-authored-by: ochakov <evgeny@ochakov.com>
2023-08-26 20:21:32 +09:00
Norman Breau 84166f6355 chore(android): Cleanup obsolete BuildConfig comments (#831) 2023-04-14 08:48:12 -03:00
seamlink-aalves 2c09ade500 fix(android): set applicationId (#827)
Co-authored-by: Alexandre Alves <aalves@seamlink.com>
2023-04-14 08:06:30 -03:00
Dave Alden e9db20e381 fix(android): return exception message (where it exists) (#687)
Co-authored-by: エリス <erisu@users.noreply.github.com>
Co-authored-by: jcesarmobile <jcesarmobile@gmail.com>
2021-08-11 16:56:42 +09:00
エリス 0227cdcf14 feat(android)!: support AndroidX (#751)
* feat: migrate FileProvider to androidx
* feat: add androidx.core:core with variable override ANDROIDX_CORE_VERSION
2021-08-09 23:09:29 +09:00
Pieter Van Poyer 75bf807261 Bugfix issue 711 heic format (#731)
* Android - issue/711 - support .heic format
2021-08-09 15:36:58 +02:00
Pieter Van Poyer f704689200 Bugfix issue 665 (#700)
* GH-665 - store the imageFilePath when the app is paused (onSaveInstance) and restore it back.

* Update src/android/CameraLauncher.java whitespace layout

Co-authored-by: Tim Brust <github@timbrust.de>

Co-authored-by: Tim Brust <github@timbrust.de>
2021-02-02 14:43:26 -04:00
Pieter Van Poyer ebe0517a24 Bugfix issue 341 save to photo gallery - Fixes #341, fixes #577 (#669)
* GH-341 - GH-577 Fixed the Save Photo To Album starting from camera - Android

- saveToPhotoAlbum feature fixed by taken into count content - uri. (writeUncompressedImage method) ( see: https://github.com/apache/cordova-plugin-camera/issues/611#issuecomment-700273405 )
- make saveToPhotoAlbum future proof by using the MediaStore to insert the taken image
- made a method to calculate the compressFormat based on the encodingType (JPEG or PNG)
- layout of the performCrop method is adjusted
- removed unused rotate variable inside processResultFromGallery method

* Add extra VO class to the plugin.xml

* added package declaration to new VO

* GH-341 - GH-577 https://github.com/apache/cordova-plugin-camera/pull/669#discussion_r504632953 listen to review
2020-10-16 23:48:22 -03:00
jcesarmobile 0333d001c7 breaking: remove NATIVE_URI DestinationType (#637) 2020-08-07 14:38:05 +02:00
jcesarmobile e2ecd7fe91 fix(android): return error if file url is null (#632) 2020-07-23 12:11:55 +02:00
Loïc Le Malliaud eb7fc333ee fix(android): use provider prefix to avoid conflicts other plugin providers (#510)
Co-authored-by: jcesarmobile <jcesarmobile@gmail.com>
2020-07-16 13:08:40 +02:00
jcesarmobile fd155d9705 breaking(android): stop using CordovaUri helper class (#617) 2020-07-14 16:26:09 +02:00
Jesse MacFadyen df14414203 Cache images in device storage, devices have enough space now. 2020-04-28 13:57:00 -07:00
Hazem Saleh 295e928784 (Android) Fix NullPointerException error on some Android phones (#429) 2019-05-05 19:16:20 +02:00
Hazem Saleh a13665d530 AAR-232: (android) Enhancement: Camera plugin code cleanup (#425) 2019-03-01 14:00:39 -05:00
Álvaro Herrero 81b878da59 GH-329: (android) Fixes issue: Exif data lost on many cases (#331)
* GH-329 android: Fix Exif data lost when correctOrientation is true

* Changed variable name
2019-02-21 16:51:54 +01:00
jcesarmobile 60e779559e Android: return DATA_URL for ALLMEDIA if it's an image (#382) 2018-12-09 12:39:06 +01:00
Hazem Saleh 5ec121bf98 CB-14047: (android) CameraLauncher: Replacing Repeated String literals with final variables (#319) 2018-04-22 14:33:52 -04:00
Alpesh Patel bf935dfbd2 CB-13415 (android) Importing corrupt images using the Camera plugin c… (#309)
* CB-13415 (android) Importing corrupt images using the Camera plugin crashes the app
2018-02-08 13:12:16 +01:00
rpanadero 36ea63a60f CB-13781: (android) Fixed permissions request on Android 8 to save a photo into the photo album 2018-01-15 13:05:10 +01:00
José Luis Ballesteros del Val 3b8f64e330 CB-12964: (android) Fix of bug when Pictures folder did not exist.
If someone had removed Pictures folder in android, plugin failed trying to move there the new photo. This happened because plugin did not check the existence of this folder, and if not, it did not complete the folder tree.

This closes #273
2017-07-04 14:03:10 +03:00
Sergii Stotskyi c3d7e55ad4 CB-12682: (ios, android): changes cancel error message to be consistent for ios android 2017-06-07 07:36:30 +03:00
Joe Bowser bba8283d98 CB-12005: Changing the getOrientation method to return the defined enumerated EXIF instead of orientation in degrees for Consistency
This closes #252
2017-02-02 12:10:42 -08:00
Sergey Zolotarev d29c767f07 CB-12368: Fix permission check on Android
The plugin was checking whether camera permission was granted but then
actually requested permission for external storage.

Surprisingly enough this fixed CB-12368.
2017-01-30 23:52:54 +01:00
Joe Bowser 84f96c1067 CB-11625: Files Provider does not work with Android 4.4.4 or lower, and I have no idea why. Working around with CordovaUri 2016-10-27 13:37:03 -07:00
Joe Bowser 61064ae3ed CB-11625 (Android) : Make this work with previous versions of Cordova via cordova-plugin-compat 2016-10-21 15:12:34 -07:00
Joe Bowser b63a0d83e0 Merging API 24 code with master including large refactor 2016-09-01 15:11:33 -07:00
swbradshaw 0ed6406864 Merge remote-tracking branch 'refs/remotes/apache/master'
Rebase from Master
2016-08-26 20:30:35 -04:00
Simon MacDonald 6e19147b09 Plugin uses Android Log class and not Cordova LOG class 2016-08-22 15:52:52 -04:00
Joe Bowser 3ed3d887ca BuildConfig from test project crept in source code thanks to Android Studio, removing 2016-08-04 11:35:39 -07:00
Joe Bowser 00e0a7dc46 CB-11625: Managed to get Content Providers to work with a weird mix of Content Providers and non-Content Providers 2016-08-03 14:43:11 -07:00
Joe Bowser 3d26986bfd CB-11625: Working on fix to API 24 no longer allowing File URIs to be passed across intents 2016-07-27 14:06:07 -07:00
Vladimir Kotikov fed798e6c7 CB-11447 Respect output format when retrieving images from gallery 2016-07-26 15:59:52 +03:00
Julio César 0115458ce8 Set android quality default value to 50 on the java code
Default value is set to 80 on the java code, but doc says that default
value is 50.

I’m changing it just for making code clearer, but default value is set
to 50 to all platforms in Camera.js if no value is passed
2016-05-16 19:43:01 +02:00
swbradshaw e3a431cbeb Reverted indenting done by Android Studio 2016-05-12 21:25:36 -04:00
swbradshaw 832d6e3bea Adding missing function 2016-05-12 13:19:35 -04:00
swbradshaw f2b4eeded0 CB-4078: Fix for orientation/scaling on Android 4.4+ devices
The only way to get rotation for photos in library (Gallery, File
System, Google Drive,etc) is to first create a temporary file from the
provider. Only then can we determine the orientation and scale the
bitmap correctly. By doing it in a central place, it eliminates reading
the inputstream repetitively in the plugin.
2016-04-27 22:27:37 -04:00