You should always accompany your puppy outside for potty breaks. You’re there not only to ensure that he actually goes, you’re also there to reward your puppy with a treat for going in the proper spot. Wait until your puppy finishes eliminating and immediately give him a tasty reward for a job well done. If you wait until you get back in the house, your puppy won’t make the connection between his elimination and the reward.
Clicker training, a common form of positive reinforcement, is a simple and effective dog training method. Although it is still fine to train your dog without clicker training, many people find it helpful. With clicker training, you can easily and effectively teach your dog all kinds of basic and advanced commands and tricks. It's fast and easy to learn how to clicker train your dog
One of the biggest mistakes new puppy owners make is expecting their puppy to hold it for longer than he is physically capable. The general guideline for puppy “hold times” is that each month of age equates to an hour of “hold time,” so a two-month-old puppy can hold it for roughly two hours. There are exceptions to the rule; your puppy should be able to hold it for slightly longer period of time at night as he gets older and you pup will need potty breaks more frequently when he’s playing.
Though it differs by each individual dog this is the time when most will come up with their own little way of letting you know they’ve got to go. It might be crying at your feet, ringing a bell you’ve set up or waiting at the door — just be sure to pay attention to these signals & follow up. Once your dog knows how to get your attention when he’s got to go you can relax a little and congratulate yourself on a job well done.
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.
The process is the exactly same for older dogs as it is for puppies; prevent accidents from happening by using baby gates and a crate if possible, create a predictable schedule, learn to recognize your dog’s potty signals, accompany your dog outside and immediately reward for all outdoor elimination, properly clean any accidents and supervise your dog until you’re sure that he understands the rules.