An electronic device comprising: a housing that comprises a first surface, a second surface opposite to the first surface, and a side surface that surrounds at least part of a space between the first and second surfaces; a Radio Frequency, RF, communication circuit (540; 640; 740; 840) disposed in the housing; a first conductive member which is electrically conductive and disposed in the housing; a switching circuit (520; 620; 720; 820; 920; 2020) disposed in the housing; a sensor (550; 650; 760; 850; 940; 2030; 2120; 2220; 2320) electrically connected to the first conductive member through the switching circuit and configured to detect at least one of contact and proximity of an external object to the first conductive member; a processor (560; 660; 770; 860; 950; 2610) electrically connected to the RF communication circuit, the switching circuit, and the sensor; and a memory electrically connected to the processor, wherein the electronic device is characterized in that the memory stores instructions that allow the processor, when being executed, to: determine whether at least a part of the electronic device is deactivated; control the switching circuit to electrically separate the sensor and the first conductive member from each other when the at least a part of the electronic device is deactivated; while the sensor and the first conductive member are electrically separated from each other, acquire first data which comprises an internal capacitance by using the sensor; store an offset value based on the internal capacitance; control the switching circuit to electrically connect the sensor and the first conductive member when the at least a part of the electronic device is not deactivated; while the sensor and the first conductive member are electrically connected to each other, acquire second data by using the sensor; and determine whether a user's body is in contact or near contact with the first conductive member at least partially based on the offset value and the second data. a housing that comprises a first surface, a second surface opposite to the first surface, and a side surface that surrounds at least part of a space between the first and second surfaces; a Radio Frequency, RF, communication circuit (540; 640; 740; 840) disposed in the housing; a first conductive member which is electrically conductive and disposed in the housing; a switching circuit (520; 620; 720; 820; 920; 2020) disposed in the housing; a sensor (550; 650; 760; 850; 940; 2030; 2120; 2220; 2320) electrically connected to the first conductive member through the switching circuit and configured to detect at least one of contact and proximity of an external object to the first conductive member; a processor (560; 660; 770; 860; 950; 2610) electrically connected to the RF communication circuit, the switching circuit, and the sensor; and a memory electrically connected to the processor, wherein the electronic device is characterized in that the memory stores instructions that allow the processor, when being executed, to: determine whether at least a part of the electronic device is deactivated; control the switching circuit to electrically separate the sensor and the first conductive member from each other when the at least a part of the electronic device is deactivated; while the sensor and the first conductive member are electrically separated from each other, acquire first data which comprises an internal capacitance by using the sensor; store an offset value based on the internal capacitance; control the switching circuit to electrically connect the sensor and the first conductive member when the at least a part of the electronic device is not deactivated; while the sensor and the first conductive member are electrically connected to each other, acquire second data by using the sensor; and determine whether a user's body is in contact or near contact with the first conductive member at least partially based on the offset value and the second data. determine whether at least a part of the electronic device is deactivated; control the switching circuit to electrically separate the sensor and the first conductive member from each other when the at least a part of the electronic device is deactivated; while the sensor and the first conductive member are electrically separated from each other, acquire first data which comprises an internal capacitance by using the sensor; store an offset value based on the internal capacitance; control the switching circuit to electrically connect the sensor and the first conductive member when the at least a part of the electronic device is not deactivated; while the sensor and the first conductive member are electrically connected to each other, acquire second data by using the sensor; and determine whether a user's body is in contact or near contact with the first conductive member at least partially based on the offset value and the second data.