It is impossible to know that you are 100% sure. As a rule, the GPS signal will be weaker, but not always. In addition, the fact that the user's coordinates are on the road does not mean that he can be closed, and the signal strength can be a week, and the coordinates are corrupted. However, depending on how accurate you want your algorithm to be, you could rely on signal strength (and possibly position) to give you something.
If you want to go to the next level, although it may turn out to be a waste of time, given that the user usually has models of movement (at home for work, work in the store, Sunday in the park, etc.)), you can try above. as well as several other parameters, such as a pedometer (moving, walking, running), speed (high speed, lack of movement from the pedometer, means that it is in the car), noise, brightness, etc. and run a logistic regression algorithm, possibly requiring user feedback as a training set. However, as you can see, this will become quite large and definitely not worth it if your application is small.
source share