Forum Xamarin.Forms

Detect when phone is still

veso266veso266 Member ✭✭

Hi there
I was wondering if it is possible in Android and iOS to detect if phone is still, eather with GPS/Geofencing or Gyro

I would like to fire an event when phone moves

now it would be great if this could be performed in the background if possible

Thanks for Anwsering and Best Regards

Best Answer


  • JohnHardmanJohnHardman GBUniversity mod


    Use James Montemagno's Xam.Plugin.Geolocator NuGet package. See

  • veso266veso266 Member ✭✭

    @JohnHardmanJohnHardman Thanks, but this only works in Foreground

    How would I eather make this work in Background or better (android only) create Foreground service so it would always tell me if phone is still?

  • JohnHardmanJohnHardman GBUniversity mod


    See and the links on that page regarding working in background and interacting with a foreground service.

    Regarding "still", it really depends on how you define "still" and how you handle the hardware returning different results even without the phone moving.

    If "still" refers to having the same GPS position now and in 30 seconds time, you can use a timer and either request the position at intervals, or check whether a position changed event has occurred within the defined period. However, neither is foolproof, as the hardware may return different GPS information even without the phone moving. As a result, you would have to decide what constitutes a real movement and what is just the GPS hardware returning different results as signal reception changes etc.

    Alternatively, you could assume that if a phone changes position, the angles at which the phone is positioned in 3 dimensions will also change. So, if "still" means that the phone orientation has not changed, you could actually get the angular information for the phone rather than the GPS information. It all depends on what "still" means in your particular requirements.

  • veso266veso266 Member ✭✭

    @JohnHardmanJohnHardman GPS is not reliable it changes too much

    the problem I am having is that when using AltBeacon library on about 10 minutes my phone would lose beacon signal and fire onExitEvent:

    now my beacon broadcast on 10ms and I have set
    BeaconManagerImpl.ForegroundBetweenScanPeriod = 30000;
    BeaconManagerImpl.BackgroundBetweenScanPeriod = 30000;
    to 30 seconds
    this means on about 10minutes signal would be lost

    so to mitigate that (as the phone is mostly on the table) I wanted to check if phone is still

    I just want to check if human moved the phone, not sure realy how to do that reliebly

Sign In or Register to comment.