Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
31334d5ebc | ||
![]() |
9b6d91009d |
18
plugin.xml
18
plugin.xml
@ -30,10 +30,6 @@
|
||||
<repo>https://git-wip-us.apache.org/repos/asf/cordova-plugin-camera.git</repo>
|
||||
<issue>https://issues.apache.org/jira/browse/CB/component/12320645</issue>
|
||||
|
||||
<engines>
|
||||
<engine name="cordova-android" version=">=5.0.0-dev" />
|
||||
</engines>
|
||||
|
||||
<js-module src="www/CameraConstants.js" name="Camera">
|
||||
<clobbers target="Camera" />
|
||||
</js-module>
|
||||
@ -54,12 +50,12 @@
|
||||
<feature name="Camera">
|
||||
<param name="firefoxos-package" value="Camera" />
|
||||
</feature>
|
||||
</config-file>
|
||||
|
||||
</config-file>
|
||||
|
||||
<js-module src="src/firefoxos/CameraProxy.js" name="CameraProxy">
|
||||
<runs />
|
||||
</js-module>
|
||||
</platform>
|
||||
</platform>
|
||||
|
||||
<!-- android -->
|
||||
<platform name="android">
|
||||
@ -80,6 +76,8 @@
|
||||
<clobbers target="CameraPopoverHandle" />
|
||||
</js-module>
|
||||
|
||||
<framework src="com.android.support:support-v4:23+" />
|
||||
|
||||
</platform>
|
||||
|
||||
<!-- amazon-fireos -->
|
||||
@ -102,7 +100,7 @@
|
||||
</js-module>
|
||||
|
||||
</platform>
|
||||
|
||||
|
||||
<!-- ubuntu -->
|
||||
<platform name="ubuntu">
|
||||
<config-file target="config.xml" parent="/*">
|
||||
@ -151,11 +149,11 @@
|
||||
<framework src="MobileCoreServices.framework" />
|
||||
<framework src="CoreGraphics.framework" />
|
||||
<framework src="AVFoundation.framework" />
|
||||
|
||||
|
||||
<config-file target="*-Info.plist" parent="NSLocationWhenInUseUsageDescription">
|
||||
<string></string>
|
||||
</config-file>
|
||||
|
||||
|
||||
</platform>
|
||||
|
||||
<!-- blackberry10 -->
|
||||
|
@ -58,6 +58,9 @@ import android.provider.MediaStore;
|
||||
import android.util.Base64;
|
||||
import android.util.Log;
|
||||
import android.content.pm.PackageManager;
|
||||
|
||||
import android.support.v4.app.ActivityCompat;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
/**
|
||||
* This class launches the camera view, allows the user to take a picture, closes the camera view,
|
||||
* and returns the captured image. When the camera view is closed, the screen displayed before
|
||||
@ -117,7 +120,9 @@ public class CameraLauncher extends CordovaPlugin implements MediaScannerConnect
|
||||
|
||||
protected void getReadPermission(int requestCode)
|
||||
{
|
||||
cordova.requestPermission(this, requestCode, Manifest.permission.READ_EXTERNAL_STORAGE);
|
||||
ActivityCompat.requestPermissions(cordova.getActivity(),
|
||||
new String[]{Manifest.permission.READ_EXTERNAL_STORAGE},
|
||||
requestCode);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -178,7 +183,7 @@ public class CameraLauncher extends CordovaPlugin implements MediaScannerConnect
|
||||
// preserve the original exif data and filename in the modified file that is
|
||||
// created
|
||||
if(this.mediaType == PICTURE && (this.destType == FILE_URI || this.destType == NATIVE_URI)
|
||||
&& fileWillBeModified() && !cordova.hasPermission(permissions[0])) {
|
||||
&& fileWillBeModified() && !(ContextCompat.checkSelfPermission(cordova.getActivity(), permissions[0]) == PackageManager.PERMISSION_GRANTED)) {
|
||||
getReadPermission(SAVE_TO_ALBUM_SEC);
|
||||
} else {
|
||||
this.getImage(this.srcType, destType, encodingType);
|
||||
@ -238,7 +243,7 @@ public class CameraLauncher extends CordovaPlugin implements MediaScannerConnect
|
||||
* @param returnType Set the type of image to return.
|
||||
*/
|
||||
public void callTakePicture(int returnType, int encodingType) {
|
||||
if (cordova.hasPermission(permissions[0])) {
|
||||
if (ContextCompat.checkSelfPermission(cordova.getActivity(), permissions[0]) == PackageManager.PERMISSION_GRANTED) {
|
||||
takePicture(returnType, encodingType);
|
||||
} else {
|
||||
getReadPermission(TAKE_PIC_SEC);
|
||||
|
Loading…
x
Reference in New Issue
Block a user