diff --git a/doc/index.md b/doc/index.md
index 027d7be..5f3148c 100644
--- a/doc/index.md
+++ b/doc/index.md
@@ -84,6 +84,13 @@ than `DATA_URL`.
- Windows Phone 7 and 8
- Windows 8
+### Preferences (iOS)
+
+- __CameraUsesGeolocation__ (boolean, defaults to false). For capturing JPEGs, set to true to get geolocation data in the EXIF header. This will trigger a request for geolocation permissions if set to true.
+
+
+
+
### Amazon Fire OS Quirks
Amazon Fire OS uses intents to launch the camera activity on the device to capture
@@ -221,7 +228,7 @@ Optional parameters to customize the camera settings.
FRONT : 1 // Use the front-facing camera
};
-### Amazon Fire OSQuirks
+### Amazon Fire OS Quirks
- Any `cameraDirection` value results in a back-facing photo.
diff --git a/plugin.xml b/plugin.xml
index 09599e5..9e9d0fa 100644
--- a/plugin.xml
+++ b/plugin.xml
@@ -126,6 +126,7 @@
+
diff --git a/src/ios/CDVCamera.h b/src/ios/CDVCamera.h
index 5d4a81d..c2a71ac 100644
--- a/src/ios/CDVCamera.h
+++ b/src/ios/CDVCamera.h
@@ -57,6 +57,7 @@ typedef NSUInteger CDVMediaType;
@property (assign) bool cropToSize;
@property (strong) UIView* webView;
@property (assign) BOOL popoverSupported;
+@property (assign) BOOL usesGeolocation;
@end
diff --git a/src/ios/CDVCamera.m b/src/ios/CDVCamera.m
index ac20c39..c2409be 100644
--- a/src/ios/CDVCamera.m
+++ b/src/ios/CDVCamera.m
@@ -49,6 +49,13 @@ static NSSet* org_apache_cordova_validArrowDirections;
@synthesize hasPendingOperation, pickerController, locationManager;
+
+- (BOOL)usesGeolocation
+{
+ id useGeo = [self.commandDelegate.settings objectForKey:[@"CameraUsesGeolocation" lowercaseString]];
+ return [(NSNumber*)useGeo boolValue];
+}
+
- (BOOL)popoverSupported
{
return (NSClassFromString(@"UIPopoverController") != nil) &&
@@ -121,6 +128,7 @@ static NSSet* org_apache_cordova_validArrowDirections;
// we need to capture this state for memory warnings that dealloc this object
cameraPicker.webView = self.webView;
cameraPicker.popoverSupported = [self popoverSupported];
+ cameraPicker.usesGeolocation = [self usesGeolocation];
cameraPicker.correctOrientation = [[arguments objectAtIndex:8] boolValue];
cameraPicker.saveToPhotoAlbum = [[arguments objectAtIndex:9] boolValue];
@@ -306,20 +314,22 @@ static NSSet* org_apache_cordova_validArrowDirections;
data = UIImageJPEGRepresentation(returnedImage, 1.0);
} else {
data = UIImageJPEGRepresentation(returnedImage, cameraPicker.quality / 100.0f);
-
- NSDictionary *controllerMetadata = [info objectForKey:@"UIImagePickerControllerMediaMetadata"];
- if (controllerMetadata) {
- self.data = data;
- self.metadata = [[NSMutableDictionary alloc] init];
-
- NSMutableDictionary *EXIFDictionary = [[controllerMetadata objectForKey:(NSString *)kCGImagePropertyExifDictionary]mutableCopy];
- if (EXIFDictionary) [self.metadata setObject:EXIFDictionary forKey:(NSString *)kCGImagePropertyExifDictionary];
-
- if (IsAtLeastiOSVersion(@"8.0")) {
- [[self locationManager] performSelector:NSSelectorFromString(@"requestWhenInUseAuthorization") withObject:nil afterDelay:0];
+
+ if (cameraPicker.usesGeolocation) {
+ NSDictionary *controllerMetadata = [info objectForKey:@"UIImagePickerControllerMediaMetadata"];
+ if (controllerMetadata) {
+ self.data = data;
+ self.metadata = [[NSMutableDictionary alloc] init];
+
+ NSMutableDictionary *EXIFDictionary = [[controllerMetadata objectForKey:(NSString *)kCGImagePropertyExifDictionary]mutableCopy];
+ if (EXIFDictionary) [self.metadata setObject:EXIFDictionary forKey:(NSString *)kCGImagePropertyExifDictionary];
+
+ if (IsAtLeastiOSVersion(@"8.0")) {
+ [[self locationManager] performSelector:NSSelectorFromString(@"requestWhenInUseAuthorization") withObject:nil afterDelay:0];
+ }
+ [[self locationManager] startUpdatingLocation];
+ return;
}
- [[self locationManager] startUpdatingLocation];
- return;
}
}