I am working on adding a release notes webView when our app is installed either for the very first time or when the app is being reinstalled. My question is on the second part where the user is installing the app on top of an existing one. I thought about deleting the release notes after it is installed but it's not possible to delete a file from assets at run time. Is there a way to determine this case?
How about saving the time when the release note was last shown in SharedPreferences, and checking it against the app install time? On fresh install there will be nothing in SharedPreferences, so you know you need to show the release note.
You can get the app install time this way:
How to get app install time from android
You can use SharedPreferences, regular File IO, or an SQLite DB in your app to store persistent information, e.g. a flag indicating if the current release notes have already been displayed or not. This data will "survive" an update of your App.
These data will, however, be deleted when the App is uninstalled from the phone, but I guess that's not a problem in your case.
Related
I'm sure it's a dumb question. But still. User activity is saved to storage (Internal/External) and SharedPreferences. Will it be available after update of the app?
Thanks for answers!
Welcome to SO!
On an update all app data remains. That's for updates that you install manually with adb or updates that get rolled out from PlayStore. This also means that if you have changes in your data model from one version to the next you'll have to make sure the new version can handle the old data.
If the app get uninstalled and reinstalled the data is usually lost but there are some instances where the OS can create backups of app data and it reappears even when an app gets uninstalled and reinstalled. See allowBackup for this.
I would like to do some clean action in my application before it will be updated from Goole Play. Eg. delete some files from previous app version.
There's any way to do this in Android?
Can't you do this at the time your app starts for the first time after update? Looks a lot easier. Just store last updated app version in user preferences or in a file and verify it every time app starts.
There is no API call for this, or any unofficial method either. However, you could have your app check a file on a server everytime it runs. You could store the latest version code in that and check it against the installed app's version code. If the version code is higher, then there is an update available. You can then do your clean up operation, and prompt the user to update the app. However, sometimes users don't update apps, so you should make sure that either the data being cleaned up is non-essential to functionality, or you force users to update the app by not letting them get past the update prompt until they have updated it.
I've published my app in google store and now I want to update it.
But I want to be assured that I don't lose stored data in my app shared preferences. I also set some alarm in my app which starts notification, and I don't want to lose them either.
I'm not sure how updating app works? does it rewrite these things? Is there anyway that I can test it before I globally publish it?
I should mention that the changes I made in this version contain some changes in manifest: I changed targetSdkVersion and minSdkVersion (It used to have minSdk=8 now I've changed it to 4 and added targetsdk=15) and I gave a process name to my alarmservice (which is an intentservice to set the alarm) but then decided to change it and it doesn't have a processname now.
Normally, the SharedPreferences(as well as other user data) will be kept during the update process, but sometimes, due to some "unknown" problem, the data may get lost, and I guess it is out of your control. So, you can simply believe that the SharedPreferences will be kept.
As for alarms, how did you set these alarms? If you set them in code, it should be 100% ok as long as you set them right in code.
Of course, the best way to test is install your updated app on your device before you push it up to the market. First, you should install your market version of app on your phone, then export your app with your market keystore on your local computer, finally, install the exported version on your phone(the installer should inform you about the update). And you can check if these settings are still there.
While exporting, the most important thing is to make sure you are using the same keystore as you use with the market version of app.
Hope this will help you.
SharedPreferences are stored and will survive updating the application. About the alarms I am not sure, sorry.
For testing your update simply install your market version on your device, set up your stuff (alarms, sharedprefs) like a normal user would do and just install the apk on your phone that you would upload to the market (signed apk!). The installing should be the same as the update your user will get...
I have load free version app on android market.I want to that user install app only one time on devices.Not second time.How to solve this problem in android devices.
One solution that came to my mind is set a value on SharedPreferences, though it can be erased/modified on rooted devices, and check if it's not set to call a webservice with the DEVICE_ID and check if already exists on your database, if not, add it.
With that.. if the user uninstall the application, next time he/she install it the SharedPreferences values will not be set, so when you call your webservice you'll see that the application was installed before on that device.
When I update some applications, I see some show "Manual update". I believe this will force uninstall of old version first and the installs fresh.
1. Is it true?
2. How do I FORCE uninstall of new version (with all preferences etc.), and install the new version fresh?
The manual update isn't going to uninstall your application, then reinstall, what is happening is because the dev has changed a security requirement of the app, the user needs to agree to it again.
So for example, if I developed a word search app with no security requirements, the user agrees to install it and uses it so decides to tick the auto update, or hits update all. My first update is simply adding puzzles - it would update fine.
I now add a feature to read a users SMS and their Contacts and use the internet to send me all the details.
The security privileges of my app have changed - now my app will not be included in the auto update or update all as the user needs to agree to these new security privileges and thus hopefully alerting the user to the outrages nature of the security requirements for this type of app.
Read More Here
If what you are trying to achieve is wiping all users data, then you need to add this to your code as I don't think it is possible to do this as a market update option (I could be wrong as its not something I would normally recommend).
To do it in code, a simple look at the app version code, and if its below X then delete prefs & or DB would do the trick I would have thought.