Wouldn’t God protect me from satan, as I am sincerely trying to follow God?

God will definitely protect His children as per His will. The Bible makes it clear – Submit yourselves therefore to God. Resist the devil, and he will flee from you. – James 4:7 

God doesn’t say I will resist the devil for you. He asks us to resist the devil.

How would I know when to resist the devil?