Thank you for your help but I found out that I just had to restart my phone.Turn on your gps, find direction to your desired location and see whether your phone points to a direction or not.
If no success, restart the phone and try again.
Ensure that there is no overheating.
Wave your phone along the x, y and z axis for a few times to calibrate the battery.