How to avoid sudden changes in the device's GPS?

I’m developing an app with a focus for use in fields or forests. Many users who have tried the app have said that when navigating through forests, the device’s GPS data changes sharply, which ends up making the user’s visual location inaccurate. The user’s location is visually represented by a point (GPS X, Y coordinates) on the map, enclosed in a circle representing the GPS accuracy area. From what I’ve read so far this is a common problem, because within forests the data is not obtained efficiently, but I’ve seen solutions in other similar applications that mitigate this problem, but since I don’t have access to the algorithm I assume that some of the following cases occur:

  1. An algorithm calculates the average of the last coordinates collected for verification and correction of the new obtained coordinate, then updates the user’s location with the corrected value.
  2. The user’s visual location remains at a fixed point with a different color when a very different coordinate is taken, until a more similar one is taken again and updates the user’s location.

I would like to know if anyone has developed something similar, or knows of any algorithm developed that already has the ideal correction and verification values. If there are other strategies to mitigate this problem I would like to know too.