## 4 Time Differenced Filter Algorithm  
According to the aforementioned characteristics analysis of the pseudorange and carrier phase observations of Xiaomi Mi 8 in Section 3, it can be summarized that, in static environments, the pseudorange outlier percentages and carrier phase cycle slips percentages are low, while they increase obviously in dynamic environments; in dynamic GNSS-degraded environments, the phase cycle slip percentages are higher than 30.31%, even at 62.25% for GLONASS satellites. Meanwhile, the phase cycle slip percentages of L1/E1 and L5/E5 are different, which indicates that the cycle slips do not always appear simultaneously on the two frequencies. Clearly, the high-precision positioning methods, such as PPP or RTK, which require high-quality pseudorange observations and continuous carrier phase observations, are not the best choice for Xiaomi Mi 8 navigation in complex urban environments. In the case of current Xiaomi Mi 8 observations, traditional observation domain smoothing methods, such as the classical Hatch filter, is not recommended for smartphone positioning due to its demand for continuous signal tracking. Here, a location domain smoothing positioning algorithm is developed for Xiaomi Mi 8 GNSS data. It first estimates the inter-epoch position variation (IEPV) with time differenced carrier phase (TDCP) observations by a least squares method, and constructs a state equation that accurately describes the receiver's movement by the IEPV. Secondly, it forms the observation equations of single-frequency L1/E1 and L5/E5 pseudorange observations. Then, the position and clock offsets of smartphones are estimated with an extended Kalman filter. Such a filter has the advantage of high-precision carrier phase observations and eliminates the shortcomings of frequent cycle slips in carrier phase observations under urban environments. The details of this method, including the state equation, observation equation, and flowchart of the time differenced filter algorithm, are described in the following sections.  
\begin{table}
\begin{tabular}{c c c c c c c c c} \hline \hline \multirow{3}{*}{**GNSS**} & \multirow{3}{*}{**Frequency**} & \multicolumn{3}{c}{**Static**} & \multicolumn{2}{c}{**Dynamic (Track 1)**} & \multicolumn{2}{c}{**Dynamic (Track 2)**} \\ \cline{3-8}  & & & **Detected** & **Cycle Slip** & & **Cycle Slip** & & **Cycle Slip** \\  & & **ADS** & **Cycle Slips** & **Percentage** & **ADS** & **Percentage** & **ADS** & **Percentage** \\  & & & **Slips** & **(\%)** & & **(\%)** & **(\%)** & **(\%)** \\ \hline \multirow{2}{*}{G} & L1 & 431 & 434 & 0.191 & 18,465 & 30.02 & 3311 & 45.32 \\  & L5 & 546 & 586 & 0.627 & 5227 & 32.46 & 1187 & 42.89 \\ \hline \multirow{2}{*}{E} & E1 & 43 & 45 & 0.058 & 9734 & 25.27 & 1882 & 37.12 \\  & E5 & 619 & 641 & 0.837 & 9280 & 24.09 & 2132 & 41.96 \\ \hline \multirow{2}{*}{J} & L1 & 516 & 517 & 0.810 & 4651 & 22.77 & 757 & 36.48 \\  & L5 & 344 & 551 & 0.862 & 3752 & 18.37 & 630 & 30.31 \\ \hline R & L1 & 958 & 964 & 1.823 & 18,177 & 29.68 & 1401 & 62.25 \\ \hline C & L1 & 3197 & 3199 & 0.715 & 9560 & 32.60 & 3821 & 52.62 \\ \hline \hline \end{tabular}
\end{table}
Table 2: Statistical information of Xiaomi Mi 8 carrier phase cycle slips.