How do I ensure that a file I created with the application stays in the iOS and Android device even if the application is deleted with Flutter?
Is there a way to this?
I used flutter path_provider, I save it in the external storage in the documents folder, but when the application is deleted, the file is deleted.
Let me explain why I want to do this. Since no unique information about the device can be obtained in applications anymore, I want to do this by giving a unique id with the file I have printed in it, such as imei number or mac address.
CodePudding user response:
About using "non-deletable" file
Personally, i don't think creating file that containing your unique id is reliable. On Android, user have many ways to delete your file (which is properly stored in external storage) intentionally or unintentionally.
Propose solution
iOS: using keychain with your defined unique id
Android: ANDROID_ID
But Android is somewhat unreliable itself. it has been reported that it can be null when app first run, or can be changed after factory reset. The higher android version code the more stable it is. So using it at your own risk.
Quick pick up: https://github.com/GigaDroid/flutter_udid
References: