An electronic device (101, 1110), comprising: a housing including a portion configured to be attached to/detached from a part of a user's ear; at least one microphone included in the housing and configured to receive a sound from the outside and to detect a direction from which the sound is received; at least one speaker included in the housing; at least one communication circuit included in the housing; a processor included in the housing and electrically connected to the at least one microphone, the at least one speaker, and the at least one communication circuit; and at least one memory included in the housing and electrically connected to the processor, wherein the memory stores instructions that, when executed, cause the processor: to store data regarding a sound, which has been received through the microphone, in the memory at least temporarily, to output a sound, which corresponds to a sound received from a first direction among the data, through the speaker, and to output a sound, which corresponds to a sound received from a second direction among the data, through the speaker based on information regarding a state of the electronic device (101, 1110) and information acquired from the outside of the electronic device via the communication circuit, wherein the information acquired from the outside of the electronic device includes information about an external electronic vehicle device being connected to the electronic device via a first external electronic device, characterized in that the information regarding the state of the electronic device (101, 1110) or the information acquired from the outside of the electronic device contains information about vibrations, wherein the processor is further configured to determine that a user of the electronic device gets into a vehicle if the vibrations of at least a predetermined strength last for at least a predetermined time, and wherein the vibrations are detected by an accelerometer sensor. a housing including a portion configured to be attached to/detached from a part of a user's ear; at least one microphone included in the housing and configured to receive a sound from the outside and to detect a direction from which the sound is received; at least one speaker included in the housing; at least one communication circuit included in the housing; a processor included in the housing and electrically connected to the at least one microphone, the at least one speaker, and the at least one communication circuit; and at least one memory included in the housing and electrically connected to the processor, wherein the memory stores instructions that, when executed, cause the processor: to store data regarding a sound, which has been received through the microphone, in the memory at least temporarily, to output a sound, which corresponds to a sound received from a first direction among the data, through the speaker, and to output a sound, which corresponds to a sound received from a second direction among the data, through the speaker based on information regarding a state of the electronic device (101, 1110) and information acquired from the outside of the electronic device via the communication circuit, wherein the information acquired from the outside of the electronic device includes information about an external electronic vehicle device being connected to the electronic device via a first external electronic device, characterized in that the information regarding the state of the electronic device (101, 1110) or the information acquired from the outside of the electronic device contains information about vibrations, wherein the processor is further configured to determine that a user of the electronic device gets into a vehicle if the vibrations of at least a predetermined strength last for at least a predetermined time, and wherein the vibrations are detected by an accelerometer sensor. to store data regarding a sound, which has been received through the microphone, in the memory at least temporarily, to output a sound, which corresponds to a sound received from a first direction among the data, through the speaker, and to output a sound, which corresponds to a sound received from a second direction among the data, through the speaker based on information regarding a state of the electronic device (101, 1110) and information acquired from the outside of the electronic device via the communication circuit, wherein the information acquired from the outside of the electronic device includes information about an external electronic vehicle device being connected to the electronic device via a first external electronic device, characterized in that the information regarding the state of the electronic device (101, 1110) or the information acquired from the outside of the electronic device contains information about vibrations, wherein the processor is further configured to determine that a user of the electronic device gets into a vehicle if the vibrations of at least a predetermined strength last for at least a predetermined time, and wherein the vibrations are detected by an accelerometer sensor.