Reputation: 68
I have a flutter app and I use flutter secure storage. I am implementing FCM ( Firebase Cloud Messaging ) push notifications in the application.
I have a main screen where, after the user logged in I, check if the user is using the app for the first time or if the app was uninstalled.
I do this check by a key from secure storage, if the value of the key is null then I assume that the user is using for the first time the app. So if it is for the first time I insert in the databse the token received from firebase.
The question: Is this approach valid for the case when the app was uninstalled or the storage cleared? Normally if the user uninstalled the application and after a while he install the app again the storage should be cleared and that key should be null, right?
Thank you!
Upvotes: 1
Views: 849
Reputation: 46
I figure out an idea to get device id using platform_device_id and store it on web when the user uninstall app and reinstall again i will know user old usage
Upvotes: 0
Reputation: 869
This approach is valid however not is the best solution because if the app is unistalled you lost the key, the best approache is save the unique device id in your own backend and check this value when the app start. (You can use this flutter package https://pub.dev/packages/flutter_udid).
If you don't want use a package, you check if one user is created or no, if the user has been created in your backend not is the first time.
Upvotes: 1