Are there examples of using if statements in pre-uninstall scripts?

W
Wilmer
Orlando Health

I'm looking to set an apk uninstall followed by an install of a newer version.  Is there a way to set if version of bundle/ID = x.x.x continue with uninstall else discontinue?

6 years ago
Android
ANSWERS
RC
Raymond Chan Diamond Contributor
6 years ago

As far as I know, 'IF" script command is, in general, NOT supported for most script application cases (including  scripts in pcg package) for Android platform.

MD
Matt Dermody Diamond Contributor
6 years ago

The If-Then logical statements are not supported in the scripting for Android devices. This includes the Send Script option, File Sync scripts, Package scripts, Out of Contact Policy scripts, etc. 

I would simply have a script that uninstalls the previous bundle ID as a Pre-Install script of your new package deployment. There is no harm in attempting to run an uninstall if the app isnt there. 

S
Scott Silver Contributor
6 years ago

...but boy wouldn't it be great to use an if-then to utilize "update" instead of remove/install...

MD
Matt Dermody Diamond Contributor
6 years ago

Having if-then statements combined with being able to take user input from a pop up window would be a dream come true in Android.

RC
Raymond Chan Diamond Contributor
6 years ago

I requested something like that long time ago.