1

Our App runs on iOS and Android and receives notifications via Firebase.

We need to be able to immediately detect when a user has uninstalled an App so that we can send notifications by another means (e.g. SMS or SMTP).

This is fine for Android as we can detect whether the App IID is still valid via the Firebase Admin API before we send a notification.

However this does not work for notifications to iOS. If a user uninstalls, Firebase still thinks the App IID is valid and forwards the notification onto the APN gateway (obviously nothing appears on the device because the App has gone).

So - how can a Server detect that an iOS app has been installed?

Thanks.

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
MHugh
  • 455
  • 1
  • 7
  • 20
  • 2
    In iOS there is no way to detect that app was uninstall. – Bohdan Savych Mar 13 '19 at 13:00
  • @BohdanSavych Are you sure? Because on FCM documentation it's written that `If the client app is automatically unregistered, which can happen if the user uninstalls the application. For example, on iOS, if the APNs Feedback Service reported the APNs token as invalid.` https://firebase.google.com/docs/cloud-messaging/http-server-ref#error-codes – genericUser May 11 '21 at 08:55

1 Answers1

1

To answer your question in one word: No. It's not possible on iOS to detect the uninstallation of your app.

EDIT: As a workaround you could save the date of the last app launch on the server and when it's e.g. more than >30 days in the past you mark the app as "probably uninstalled".

Victor Pro
  • 199
  • 4
  • So another way of putting this problem is that I want to be able to detect successful delivery to the device (successful here includes the assumption that the app must be installed). Although the answers here state it is not doable, I notice that WhatsApp seems to be able to do this. If you send to a platform where the App is not installed it will only give a single grey tick. If the App is installed it gives two grey ticks. Any suggestions on how to detect App installation like this ? – MHugh Mar 14 '19 at 14:51
  • 1
    @MHugh WhatsApp also doesn’t detect whether the recipient has the app installed or not. It only detects when the recipient receives a message (by sending a kind of confirmation to the sender). You could do this as well. But you cannot differentiate between “User uninstalled the app” and “User is currently offline or not reachable”. – Victor Pro Mar 14 '19 at 14:54
  • I have been looking at sending confirmation back to the server. This works OK if App is in foreground or background (by sending data notification which fires DidRecieveRemoteNotification in App), however if App is not running it does not seem possible to do this - although WhatsApp is doing it somehow. Any ideas how to trigger App to callback with confirmation if it is not running ? Thanks. – MHugh Mar 15 '19 at 11:07
  • @MHugh Maybe I mix something up, but isn’t it very simple? App is in foreground or background mode, receives a message and confirms it. If you don’t get a confirmation, either the app has been uninstalled or the app has not been opened with a working internet connection. – Victor Pro Mar 15 '19 at 12:00
  • For example, after the device boots up - the App is not in foreground or background. The state is "non running" (The app has not been launched or was running but was terminated by the system). Another example, when the user terminates the App. This is neither foreground nor background. WhatsApp seems able to acknowledge delivery when "not running". Any ideas on how it does this? – MHugh Mar 15 '19 at 12:24
  • @MHugh I get your point, but I also can’t offer a solution, unfortunately. Maybe this helps: https://stackoverflow.com/questions/40119069/know-if-the-app-received-the-notification-from-server-side – Victor Pro Mar 15 '19 at 12:27