I have a Nikon D3100, & a YN560II Speedlite. Sometimes when I want to use my speedlite, the auto flash will pop up when I take a photo. I know I've not done something right in my setting, can someone help me.
The Nikon internal flash is supposed to popup if camera is in Auto mode, anytime when the system thinks flash will be helpful. It Never pop ups in camera A, S, P, or M modes, where the user opens the flash door to use flash, and user does not open door if not wanting flash (user control).
But Auto mode pops open the flash. However it should not popup if it detects a hot shoe flash in place. However, the Yongnuo YN560 (not capable of TTL) is possibly not CLS compatible, communication wise (there would be no point of it for opertating the flash, since the flash is Manual). The camera probably is unaware of the manual YN560 presence (the camera would be very aware of any iTTL flash, they must communicate via the hot shoe pins).
So use camera A, S, P, or M for flash with the popup.
YN560 cannot do TTL, but FWIW, flash TTL is still automatic flash even in camera Manual mode.
Realize that Auto mode is auto everything, no user control.
Camera P mode is auto exposure (of ambient), but is NOT Auto ISO or Auto White Balance, unless you have set those on yourself. Nor auto color profile either (like Vivid). The user sets stuff in A, S, P, or M modes.
I would check how your YN-560 is seated on the flash hotshoe. Inside the rails of your camera's hotshoe, there should be a physical switch that tells the camera when an external flash is mounted, and this should prevent the pop-up flash from popping up. If the camera isn't getting that signal, the switch could be stuck or broken, or your flash may not be seated all the way forward in the shoe.