handled code to get device id