The app doesn't have to do this itself, phones do it for you. ARCore on Android, ARKit on iOS.
https://www.youtube.com/watch?v=C7JQ7Rpwn2k&t=1401s (the whole video is incredible, but this timestamp is the magical bit)
IMU are very useful to known your orientation though. Even an inaccurate IMU is useful to provide an initial estimate to feed vision-based algorithms.
1) An absolute positioning system like GPS.
2) A visual positioning system like fiducial markers or SLAM.
3) Something that can measure linear speed and then you integrate the speed only once. Easy to do on vehicles, but even the most accurate system will quickly drift.