safe get device ID