How to detect an iOS App installed or upgraded?
You can differentiate between the first start after installing the App, the first start after an update and other starts quite easily via saving the latest known version to standardUserDefaults
. But as far as I know it is not possible do detect a re-install of the App as all App-related data are also removed when the App is deleted from the device.
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
NSString* currentVersion = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleVersion"];
NSString* versionOfLastRun = [[NSUserDefaults standardUserDefaults] objectForKey:@"VersionOfLastRun"];
if (versionOfLastRun == nil) {
// First start after installing the app
} else if (![versionOfLastRun isEqual:currentVersion]) {
// App was updated since last run
} else {
// nothing changed
}
[[NSUserDefaults standardUserDefaults] setObject:currentVersion forKey:@"VersionOfLastRun"];
[[NSUserDefaults standardUserDefaults] synchronize];
}
How to determine location from which Windows 10 UWP app was installed with App Installer
I'm pretty sure this didn't exist years ago, when this question was asked, but now the answer is as simple as:
Get-AppxPackageAutoUpdateSettings -PackageFamilyName xyz
The output contains the row: AppInstallerUri: https://example.com[...]
I guess you could isolate that by running:
(Get-AppxPackageAutoUpdateSettings -PackageFamilyName xyz).AppInstallerUri
Detect if new install or updated version (Android app)
public static boolean isFirstInstall(Context context) {
try {
long firstInstallTime = context.getPackageManager().getPackageInfo(context.getPackageName(), 0).firstInstallTime;
long lastUpdateTime = context.getPackageManager().getPackageInfo(context.getPackageName(), 0).lastUpdateTime;
return firstInstallTime == lastUpdateTime;
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
return true;
}
}
public static boolean isInstallFromUpdate(Context context) {
try {
long firstInstallTime = context.getPackageManager().getPackageInfo(context.getPackageName(), 0).firstInstallTime;
long lastUpdateTime = context.getPackageManager().getPackageInfo(context.getPackageName(), 0).lastUpdateTime;
return firstInstallTime != lastUpdateTime;
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
return false;
}
}
How to check the first date an app is installed?
You can get App receipt from the store (here is how it can look like) and parse the PurchaseDate of your product. However this will return the date when the app has been first installed, if the user has reinstalled the app, then it will return the date of the very first installation (first 'purchase' from the store).
You can also have a value in LocalSettings that will be responsible for remembering the date of first run of the app. But this doesn't mean the date of installation - user can install the app and run it after a month. Also when user reinstalls the app, you will get the new value.
Is there any method for getting details of all installed apps in a Windows device using shell commands
An alternative can be to query the registry like this for example:
# HKLM - Local Machine
$InstalledSoftware = Get-ChildItem "HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall"
foreach($obj in $InstalledSoftware){write-host $obj.GetValue('DisplayName') -NoNewline; write-host " - " -NoNewline; write-host $obj.GetValue('DisplayVersion')}
# HKCU - Current User
InstalledSoftware = Get-ChildItem "HKCU:\Software\Microsoft\Windows\CurrentVersion\Uninstall"
foreach($obj in $InstalledSoftware){write-host $obj.GetValue('DisplayName') -NoNewline; write-host " - " -NoNewline; write-host $obj.GetValue('DisplayVersion')}
Check this page out for more:
https://www.codetwo.com/admins-blog/how-to-check-installed-software-version/
Tip! Browse these locations in the registry manually before you dig in as it will help you see the structure and understand what properties are available. If the information you're seeking is not there, you might just ditch this suggestion.
Related Topics
How to Chain Filters in Metal for iOS
Didreceiveremotenotification Not Called in Background Mode
Xcode Error Extra Info About Plist: Acl=<Not Found>
Using Delegates to Transfer Data from One Tableview to Another
Display: Flex; Doesn't Work on iPad (Both Chrome and Safari)
iOS UIlabel Autoshrink So Word Doesn't Truncate to Two Lines
How to Add Pagination in UItableview.
Get All Ranges of a Substring in a String in Swift
Prepareforsegue Not Called from Custom UItableviewcell
Best Approach to Change Xib Direction Programmatically
How to Add Frameworks into the Swift Project
Uitableview Automatic Dimension Not Working Correctly
iOS 13.2 Message: Nehelper Sent Invalid Result Code [1] for Wi-Fi Information Request
How to Use Third Party Lib in Embedded Dynamic Framework for iOS with Swift
Gcm Support for iOS Application When Application in Background or Killed
App Could Not Authenticate with Facebook and Firebase After Conversion to Swift 3 Syntax