No, you need to create different widget codes for different device types. You can easily create Desktop and Mobile widgets by selecting the type of widget you want under General Settings in Campaign Settings. Please note that Desktop and Tablet uses the same widget code which means that you only need to create separate code for mobile widgets.