God is not obligated to hear the prayer of sinners unless they are repenting. When the Children of Israel were preparing to go into the land of Canaan, God gave them a remedy that would help them be successful if they obeyed Him.