PDA

View Full Version : how to know if app was re-installed on Android



franki
9th August 2013, 08:57
Hi all

I need to know during application start-up if application was re-installed.
Why? After each installation, during first start application needs to send and download some data from server, it saves this data in application directory, in some conf file. But when I simply re-install application from the same .pkg file all application data is preserved so during first start app doesn't know that it was re-installed.
I was trying some tricks:
1. Deploy empty conf file with application, so it overwrites old config, but no luck with that, it seems that read-only assets are only option if you need to ship file with application on Android.
2. I was checking created() lastRead() and lastModified() dates on main lib file located in /lib directory of my application, but created() is always date when pkg was created, and lastRead() seems to be not updated by Android system during application start
3. I was trying to modify some permissions on main lib file, like add some permissions, or change, and then when application was re-installed premissions should revert to default, but I was getting always false from QFile::setPermissions() on this main lib file, changing this file permissions is not allowed?

I'm using Qt 4.8.2, anyone knows any other tricks? I know that I can clear application cache on Android, but I need this to happen without user intervention, automagically.

best regards
Marek

Ginsengelf
9th August 2013, 12:48
Hi, without tricks:
if your data does not exist, it was a first-time installation, otherwise your app has been re-installed.

Ginsengelf

franki
9th August 2013, 15:57
HI,

first off all, sorry for the delay.

Maybe I wasn't accurate enough.
It doesn't matter if data of my application exists or not.
I need to connect to server during first-time installation as well as during re-installation, so checking if data exists is not an option.
Any other ideas?

Marek

watsonjhon
20th September 2013, 12:06
From my point of view :-

1 - If the application is already installed in the device the application is open automatically.

2 - Otherwise install the particular application.