0

Is it possible to detect if the user will remove the app in Nativescript?

I need it to unsubscribe the users in the topics of Firebase.

Thanks.

Tamás Sengel
  • 55,884
  • 29
  • 169
  • 223
Francisco L
  • 81
  • 1
  • 13
  • It's very unlikely to be supported due to detecting that the user is uninstalling your app is hard on both iOS and Android. You might be able to implement the functionality yourself. See https://stackoverflow.com/questions/21592576/how-to-detect-user-uninstalled-ios-app-i-need-push-serious-notification-i-don and https://stackoverflow.com/questions/18692571/how-can-an-app-detect-that-its-going-to-be-uninstalled – Jan Sommer Jan 02 '18 at 22:27

1 Answers1

1

Option 1: Use this solution to implement a BroadcastReceiver to catch the uninstall. Here is the documentation on Nativescript BroadcastReceiver

Option 2: Catch the event indirectly, using events like the one explained in this link. When your app package cache folder is deleted, you can catch the event in a forked process (In JS part of your NS app) and call your firebase function/update values in RT DB.

For iOS, looks like you may have to find indirect solutions by pinging as explained here and here.

Based on these solutions, it would be a lot simpler and effecient to stop ping and log devices which are not receiving the messages for n days(a parameter you can configure in Firebase remote config). On app launch event, you can reset this value, where you maintain a unique ID and active since for each device.

If you go through uninstall route, you might be restricted to limited option in Android.

Anand
  • 9,672
  • 4
  • 55
  • 75