Many owners appear disappointed that their young puppy will not toilet when out on a walk, yet relieves itself the second it gets back home. This is because the puppy has been taught to toilet only at home (hopefully in its garden), and being creatures of habit, they often wait until they have returned home before evacuating their bladder and/ or bowels.
It's not so much the dog doesn't listen, more that he doesn't understand what you want him to do. Go back to basics and don't punish him when he toilets indoors. Double your vigilance and take every opportunity to put him outside to toilet. The crucial thing is to be present when he does toilet in the correct place, so that you can reward him. This makes him keener to repeat the performance to get another treat. Conversely, if you have been telling him off for indoor accidents he may already feel inhibited about going to the toilet in your presence, including when he goes outdoors. This is one reason why it's important not to punish for inappropriate toileting.
You may also notice common behavior problems in your dog such as jumping up, barking, or even aggression. The best way to correct any misbehavior is to interrupt it. Shift your dog's attention to something positive. Try running through cues that your dog has mastered followed by rewards. Keep your demeanor cool and confident, and be clear about what you mean.
Introduce your new pup to its new home, family and their role. Just like when you are new to a place or group, your new pet may be bursting with curiosity, excitement, fear or joy. Now is the best time to lay out the foundation for a good and pleasant relationship with your pet. For a puppy to settle in and learn to trust and respect you and everyone at home, it is very important to establish your expectations of your puppy and be consistent with them.