Things to do:
1.Turn on Developer mode.
~ Go to Phone Settings > About Device> Look for build number > and TAP it 6x (times) > then Press Back
2. Click Developer mode
~ And Look for " Allow mock locations " and uncheck it. that is why pokemon go cannot detect your location. maybe you did use 3rd party applications to fake your location. if its not fixed then try to reformat your device / flash stock rom.
3. Thats it! i hope this post helps you. thanks