All mighty Allah (subhanahu wa ta'ala) said:� And when My slaves ask you (O Mohammed) concerning Me then (answer them), I am indeed near (to them by my knowledge). I respond to the invocations of the supplicant when he calls on me (without any mediator or intercessor). So let them obey Me and believe in Me, so that they may be led to the right path.�(2:186). The Prophet (peace and blessings of Allah be upon him) was asked by some of his companions: Is Allah near so we invoke him or is he far so we call him? so Allah revealed this verse. Allah (subhanahu wa ta'ala) is near He can hear the supplicant anytime anywhere and respond to him if the supplicant invokes Allah (subhanahu wa ta'ala) with a sincere heart and avoid interdictions of supplication. Allah (subhanahu wa ta'ala) also said:� Invoke your Lord with humility and in secret, He likes not the aggressors.�(7:55).
Supplication is of two kinds. One is worship and the other is a request. So He commands to be invoked with "humility" which is insisting in request and continuously in worship and "secretly" not loud to avoid "Ryea" (show off). Allah (subhanahu wa ta'ala) also said:� And your Lord said: -Invoke Me [i.e. believe in My Oneness] (and ask Me for anything) I will respond to your (invocation). Verily! Those who scorn My worship [i.e. do not invoke Me, and do not believe in My Oneness] they will surely enter hell in humiliation!�(40:60). Allah (subhanahu wa ta'ala) said:� Invoke Me, I will respond to you� ,so from His mercy for His slaves He has promised to respond to their invocations but for those who do not invoke Him, He has promised punishment because invocation of Allah (subhanahu wa ta'ala) is an act of worship and refusing to invoke Him ( disbelieving in Him or having doubt in His ability to answer the invocation) is refusal to worship Him.