An electronic device comprising: a camera comprising a lens; a distance sensor for detecting a distance value relative to an object; a memory for storing calibration data comprising a look-up table which matches a lens location of the camera to the distance value detected by the distance sensor; and a processor operatively connected with the camera, the distance sensor, and the memory, wherein the memory stores instructions that, when executed, cause the processor to: determine the lens location of the camera using the distance value, detected by the distance sensor, and the calibration data, by searching for the lens location matching the distance value from the calibration data in the look-up table, based on the camera being operated; execute an auto focus function using the determined lens location of the camera; obtain lens location data, including information about the distance value for the object and the lens location focused on the object as a result of executing the auto focus function; obtain a brightness value while the camera is operated; identify whether the brightness value is lower than a specified value; if the brightness value is lower than the specified value, maintain the calibration data; if the brightness value is greater than or equal to the specified value, update the calibration data based on the obtained lens location data; and determine the lens location of the camera based on the updated calibration data. a camera comprising a lens; a distance sensor for detecting a distance value relative to an object; a memory for storing calibration data comprising a look-up table which matches a lens location of the camera to the distance value detected by the distance sensor; and a processor operatively connected with the camera, the distance sensor, and the memory, wherein the memory stores instructions that, when executed, cause the processor to: determine the lens location of the camera using the distance value, detected by the distance sensor, and the calibration data, by searching for the lens location matching the distance value from the calibration data in the look-up table, based on the camera being operated; execute an auto focus function using the determined lens location of the camera; obtain lens location data, including information about the distance value for the object and the lens location focused on the object as a result of executing the auto focus function; obtain a brightness value while the camera is operated; identify whether the brightness value is lower than a specified value; if the brightness value is lower than the specified value, maintain the calibration data; if the brightness value is greater than or equal to the specified value, update the calibration data based on the obtained lens location data; and determine the lens location of the camera using the distance value, detected by the distance sensor, and the calibration data, by searching for the lens location matching the distance value from the calibration data in the look-up table, based on the camera being operated; execute an auto focus function using the determined lens location of the camera; obtain lens location data, including information about the distance value for the object and the lens location focused on the object as a result of executing the auto focus function; obtain a brightness value while the camera is operated; identify whether the brightness value is lower than a specified value; if the brightness value is lower than the specified value, maintain the calibration data; if the brightness value is greater than or equal to the specified value, update the calibration data based on the obtained lens location data; and determine the lens location of the camera based on the updated calibration data. <EOS>