I want to create an Android application that, when connecting a USB camera device to the Android device, all applications should detect the external camera as the primary camera. For example, if we open the camera application, the device takes the picture from the one that is connected via USB. Is there a way to do this?
You cannot do this by writing a simple app as you do not decide which is the default camera. That is done by the system firmware, and you cannot modify this through the Android SDK.
The only way to achieve this would be to customize Android at a source level and add code to automatically switch the default camera to the one connected by USB when it is available.