To tell whether your phone or GPS is using a magnetic compass or is getting directions from the movement it detects, just hold or mount it so it's upside down - i.e. the top of the screen is closer to your body.
If it's using a magnetic sensor, it won't be fooled and will continue to indicate that north is ahead of you when riding northwards along a north/south road.
If it's using detected movement, it will assume that the detected northwards travel is towards the top of the screen, and will indicate that south is ahead of you.
Even if there is a magnetic sensor, a phone or GPS will often use detected movement in preference to the magnetic sensor when you are moving at a reasonable speed (cycling - i.e. faster than walking). They do this because it's not affected by things like the steel in your bike or car, and it uses less battery power too.