Flutter check if app was uninstall or first time - flutter

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!

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.

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

Related

Login one account per device at a time

I'm just new to flutter, is there a way to authenticate the user to only log in to one device at the same time without using firebase? I'm doing my research and all I'm seeing is they using firebase. My backend is Go.

How does an app remain signedIn with Google after terminating and re-opening it

I am using GoogleSignIn plugin for Flutter and able to successfully signin in to Google on my simple flutter app.
Once signed in to Google, I need to keep a track of that in the app (and store tokens in a backend service) and not ask user to login again everytime the application is opened (after terminating/closing the app).
I was planning to store the idToken in the sharedPreferences so that on every invocation of the app I could read the token value and determine if the user had already signedIn in the past.
However, I notice that this is how the app is currently working even without me storing the tokens and adding my custom logic (that is, on re-opening the app, it still stays in signedIn state).
My question is, how is it achieving this behavior with out me writing any code to achieve this?
I have tried to look in to the sharedPreferences but I do not see any tokens or identifiers being stored by the Google_sign_in flutter plugin. How is this happening?
On Android, Flutter's Google Sign-In plugin uses the GoogleSignIn API for Android, which is built into the OS and handles persistence for you.

Persistent device identifier even after app gets uninstalled

In my iPhone/iPad app's use case, there is a voting system and one device can send its vote once to the server. Therefore my server needs to identify user's device. I don't want the user to register an account because that makes the app complicate. However, I couldn't find a solution that works.
UDID is deprecated
I presume getting MAC address will get your app rejected by the app review process
I tried creating my own UUID using [[NSUUID UUID] UUIDString] and then storing it using NSUserDefaults, but the settings disappear if the user uninstalls the app
identifierForVendor is also reset when the user uninstalls the app
I considered advertisingIdentifier but because I'm not using it for advertisement, I presume it will also be rejected by the app review process
I'm not asking for a bulletproof solution in every situation. Just a solution that works even if the user uninstalls the app. Because I can generate my own UUID, I guess my question boils down to: How I can save data for the app that survives app uninstallation?
However if any of you have other approach, please feel free to inform me. Thanks.
Save the UUID into the keychain.

iphone application update

i would like to check:
if a user downloaded my app, than i make some update to app, data etc., itunes will auto remind the user of the update through app store, and the user can update for free? or do i have to set such reminder in my application?
else, is there a way for me to send this notification?
thks
Rgds
Yes, the phone notifies of app updates through the App Store app and app updates are free.
Alternatively, you can use push notifications to notify the user that a new version is available, or display an alert the next time they open the app.
To do the latter you can query the version of the app ([[NSBundle mainBundle] objectForInfoDictionaryKey:#"CFBundleVersion"];) and compare it to a value provided by your web server.

Uploading an updated version of app to the store with new app id

Our app is already there in app store. We now have integrated push notification support to our app and this requires new app id to be created, because our existing app id has got asterisk symbol in it. To enable push notification, app id should not have asterisk at the end, instead it has to have an unique name. So we decided to create a new app id which has got push notification enabled.
But if we do so, will we be able to upload our app as an update to our existing app which is there in the app store?, or our new submission will be considered as a new app? or what other problems we will be facing?
Thanks in advance!
We've gone through similar issues, and I'd like to put a disclaimer here that we don't actually have anything released yet, but we were able to use the same bundle identifier with a new app-id and a new provisioning profile, and it did overwrite the old app on the phone that had the old version.
I don't think the changed app-id will make a difference After all, if you have 10 different apps using the asterisk ID, they are still considered 10 different apps, so the app-id is probably more specific to the signing end. The Bundle-id is what determines the app's identity on the device itself, and so I think it's the same in the app store.