Reputation: 422
Is there a way to find the date an app was installed on a device using Xamarin.iOS?
Upvotes: 4
Views: 615
Reputation: 21
I solved it by adding:
var urlToDocumentsFolder = NSFileManager.DefaultManager.GetUrls(NSSearchPathDirectory.DocumentDirectory, NSSearchPathDomain.User).First();
var creationDate = NSFileManager.DefaultManager.GetAttributes(urlToDocumentsFolder.Path).CreationDate;
Upvotes: 2
Reputation: 1034
Why don't you use UserDefaults?
You could check for a key let's say "installDate", if it does't exist it means it's the first time your launching the app and you'll set the installDate as the current date. If it does exist you know that the app was launched already.
Upvotes: 2