We know that if a function $f:\mathbb{R}\to \mathbb{R}$ is uniformly continuous and Lebeasgue integrable on $\mathbb{R}$ ($\int_{-\infty}^\infty|f(x)|dx<\infty$), then $\lim_{x\to \pm \infty}f(x)=0.$
Now in the above result, if we replace the integrability on $\mathbb{R}$ by the weaker condition: $$\lim_{r\to\infty}\frac{1}{r}\int_{-r}^r|f(x)|dx=0,$$ do we still get $\lim_{x\to \pm \infty}f(x)=0?$
No, the weaker condition does not imply that $\lim_{x\to \pm \infty}f(x)=0$. Counterexample: take $$f(x):= \begin{cases} 1-\left| |x|-n^2 \right| & \text{if $||x|-n^2|<1$ for some $n\in\mathbb{N}^+$} , \\ 0 & \text{otherwise.}\end{cases}$$ Then $f$ is u.c. on $\mathbb{R}$, $\lim_{x\to \pm \infty}f(x)$ does not exist and if $n^2+1\leq r<(n+1)^2+1$ then $$0\leq \frac{1}{r}\int_{-r}^r|f(x)|dx\leq \frac{2}{r}\int_{0}^{(n+1)^2+1}|f(x)|dx=\frac{2(n+1)}{r}\leq \frac{2(n+1)}{n^2+1}\to 0.$$