Wait for the dog to turn his attention towards you.
This might take less than 2 seconds or it might take 10 minutes, depending where you chose to begin. My Labrador must know where she is in the world, which means sniffing the whole place before training can begin.
My poodle could care less and turns his focus on me instantly, unless there is a threat of some sort, which to him, could be a friendly stranger. Young dogs may be first interested in discovering the scents in the breeze or flying bugs, old dogs may need to go potty.
Never force the interaction through the promise of treats or punishment; in both situations you risk devaluing the treats or the relationship. If the animal is only paying attention because you asked them to, learning may be slower as well.
Be patient and wait for your dog to check in with you. If you get impatient, make a big deal over the treats you have until curiosity brings the dog over to you.
Throw a treat away from you. The dog should follow and come back for another treat. If he doesn’t, then find different treats.
If the dog returns, ask for a known behavior. When the dog complies, throw another treat away from you. Upon the dog’s return this time, begin training the new behavior