I asked Imam Sadiq (as): O son of Rasool Allah (s)! What is the matter that when a Momin supplicates, sometimes he is answered and sometimes he is not answered, and Allah (swt) has said (in the Holy Quran): Call upon Me, I will answer you [40:60]!
So he (as) said: When the servant supplicates to Allah (swt) with a true intention and a sincere heart, he gets answered after he has been loyal to the Covenant (ahad) of Allah (swt). And when he supplicates without a (true) intention and (without) sincerity, he does not get answered. Is Allah (swt) not saying: “Fulfil My Covenant (ahad), I (swt) will fulfill My Covenant with you [2:40]”? So the one who fulfills it, He (swt) fulfills it for him.
[Al Ikhtisaas, 1/372]