You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

.NET Core WebView安卓应用调用相机拍照后EXIF无法获取GPS信息

问题:Android WebView调用相机拍照上传无法提取EXIF GPS信息

我们开发了基于.NET Core的Web应用,使用Dropzone和EXIF实现图片上传并提取GPS经纬度。封装为Android WebView应用后遇到以下异常情况:

  • 已开启相机位置权限,但调用相机拍照上传时,无法通过EXIF获取GPS信息
  • 从相册选择图片上传时,GPS信息提取正常
  • Web端及移动端Chrome浏览器中,无论相机拍照还是相册选择上传,都能正常提取GPS信息

相关JavaScript代码

new Dropzone("#dropzone", {
                url: "#",
                paramName: "file", //the parameter name containing the uploaded file
                clickable: true,
                uploadMultiple: true,
                addRemoveLinks: true,
                autoProcessQueue: true,
                //acceptedFiles: ".png,.jpg,.jpeg,.PNG,.JPG",
                acceptedFiles: "image/*",
                capture: "camera",
                dictDefaultMessage: "<strong>Drop files here or click to upload. </strong>", //override the default text
                init: function () {
                    this.on('addedfile', function (file) {
                        if ($("#dropzone").hasClass('dropzone')) {
                            jQuery("#dropzone").attr('style', 'background-image: none !important;');
                        }

                        var isExist = existingImageName.filter(function (item) { return item === file.name });
                        if (isExist.length > 0) {
                            abp.notify.error("Image with this name is already exist,please select image with different name");
                            this.removeFile(file);
                            return;
                        }
                        else {
                            existingImageName.push(file.name);
                            imagefile.push(file);
                            var objFile = this;
                            console.log("exif calls");
                            dealLocationLat = "";
                            dealLocationLng = "";
                            EXIF.getData(file, function () {
                                    if (Object.keys(this.exifdata).length > 0) {
                                        if (AgeofImage(this.exifdata) || DealImageDateCheck(this.exifdata.DateTime)) {
                                            var allMetaData = EXIF.getAllTags(this);

内容的提问来源于stack exchange,提问作者user1407318

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.26 16:52:09