An electronic device is provided processor configured to: receive a biological signal of a user; detect whether the electronic device is attached to or detached from the user based on at least the biological signal; and control an I/O device operationally connected to the electronic device based on whether the electronic device is attached to or detached from the user.