Taken from dea.org
Can (drug sniffing) dogs detect MDMA?
Certainly. Heck, humans can often smell it. Not all dogs are trained to spot MDMA (most of those that are focus on smuggling/shipping ports, not casual users.) Another popular question is "if I walk by a drug sniffing dog with some pills on me, will he smell them?" That depends on a lot of factors. If you're carrying a few pills in an air-tight container (ideally having washed the outside of the container and your hands with soapy water) the dog might no be able to smell it. As a more practical matter, drug dogs don't actually give much attention to when they smell drugs unless their handler has ordered them to search. If a dog isn't currently in 'search' mode, you could probably walk by it with a backpack full of heroin and the dog wouldn't alert. After all, they're around drugs a lot, and need to behave when the people with the drugs are police, etc. doing their job.