Keyless Lock/Unlock not working, tried both keys, will only unlock sometimes. on 2007 Jeep Grand Cherokee

The remote keyless lock/unlock will not work for either of my keys. Sometimes if I am really close to vehicle it will work. Can unlock my car manually with key, but the alarm goes off until I put key in the ignition and start vehicle. Any suggestions on what might be wrong and how to fix?

Asked by for the 2007 Jeep Grand Cherokee
check battery