Self closing dialogs

In my mobile app, when user enters the geofence:

  • if app is in foreground, show user a dialog with a question asking him whether he really wants to visit the location
  • if app is in background, show a local notification asking driver immediate attention (user should open app to see question dialog and respond)

When user leaves the geofence, I'm thinking it makes sense to remove the dialog or local notification.

Wouldn't be an issue for user to see dialog disappearing? Imagine user looks at the screen, and suddenly the dialog disappears.

Are there other ways to handle it? Any examples of apps which do this?