Relay switching issue between 2 sources

I think relay not switching when i connected the battery

True.

When the USB is providing 5V power, the relay will be energized and USB 5V will be connected to your devices.

When USB power is unplugged, the relay will be off and battery power will be connected to your devices. Battery power does not need to switch the relay because the default condition is battery power connected.

Is this what you want? If not, how do you want it to work?