Normally B4A activities don't load when connecting to a power supply or a cable. So, did you add any static or dynamic intent filtering that causes one of your activities to start when connecting a power supply or a cable?
Otherwise, please explain in more detail the issue you are having because it is a little confusing.