wrap a rubberband, a small one, around the device plug about 1/4" inward of where the opening comes to... works great.
also, with the bike off, reach up behind that socket and firmly tighten the nut that holds the socket in, when you ride with something plugged in, it tends to loosen, and the socket will pop out... damhik
I've also jambed a strip of innertube down alonside the plugin, opposite the side contact on the plug, this seems to work best... but you might want to tie a piece of string to it, and to the flap cap, so you don't loose it...