spmoolman
spmoolman

Reputation: 422

Installed date for an iOS app using Xamarin

Is there a way to find the date an app was installed on a device using Xamarin.iOS?

Upvotes: 4

Views: 615

Answers (2)

Maxim Matusevich
Maxim Matusevich

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

Flavio Silverio
Flavio Silverio

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

Related Questions