I developed an android app ver 1.0 in which i stored the user data in shared preferences.
Now I am developing ver 2.0 and I have the following questions about updating it
1.How to detect if version 1.0 is already installed? I mean if it is a pure install(direct 2.0 install) or update from 1.0
2.If it is detected as 1.0 I want to dump the shared preferences values into database. Will the shared preferences be overwritten during update? How to prevent this? If they are not overwritten I want to write an activity which loads the values and dumps them into db
What parameter should i set so that market gives notification that update is available. Should i set that in android manifest with same keystore?
Please kindly help me out
Thanking You,
ChinniKrishna Kothapalli
The Android Documentation has a part explaining how to update your apps.
Basically you increase the number of your android:versionCode in the manifest. You should also change the android:versionName field so your users can see it's a different version.
As for your problem with dumping preferences into a database: The preferences allow you to use a default value if a certain preference is not found (when the downloads a fresh install).
I'm not sure if there is a way of detecting wether your application has been installed or not, except if you have something like a database already in your earlier version, then you could just check if it exists or not. Might not be the best practice to solve this tough.
Related
Over the last couple of years, I have been creating an app for a customer (also the reason that I unfortunately cannot share the code on here). The last version uploaded to the play store was targeted at API 25, and was published around July 2017.
I am currently testing a new update, and am finding that opening the database via the SQLiteOpenDatabase is causing the onCreate function to run. The data from the previous version of the app gets lost. I have installed the previous version of the app both via the play store and manually, but the upgrade is always performed directly from the new versions APK.
Data stored on intermediate development versions of the app doesn't get lost, but they all erase data from the currently released version.
The classes for managing the database haven't changed, and are using the same version code for the database. I have checked the certificates, and all versions have been signed with the same one.
Is anyone aware of other reasons that the database may be recreated? This is a serious issue, that is preventing the release of the application.
I was looking for a hook, like action intent, which can call my app (having a service), when an OS update has happened. (The boot when OS update has happened.)
I checked the standard action content on the Android website, but couldn't find one which I can use directly.
Thanks.
There is no special version of ACTION_BOOT_COMPLETED or other Intent actions that is unique to a reboot after an OS upgrade.
When your service gets control for any reason, compare the current Build information to some cached copy that you maintain, to see if there is a difference that matters to you.
You can check firmware version by Build.RADIO or Build.getRadioVersion() on each system reboot to find out if update occured.
I cannot ALTER table in Data Studio for last few days.. Nothing really was updated (I guess it is Eclipse environment error). Any ideas what's going on? Note: it happens when I do right-click on the table then select Alter. But it happens only to that one table. Is it because the table contains CLOB column?
I think you are right, it seems to be an eclipse environment error. Something in the .metadata has gone corrupt. This is most probably leading to a function being called recursively and consequently the StackOverflowError.
It might also be the case that you might have done some unrelated system cleanup during the time Data Studio was not being used. There might be some system file that it needs and now is unable to find.
I would suggest you use the data studio web console to monitor the health of the said database -
http://www.ibm.com/support/knowledgecenter/SS62YD_4.1.0/com.ibm.datatools.db.web.health.doc/topics/introducing.html
If it does not give any valid results, then i am afraid a reinstall is required.
I think, you have missed authorization issues. SYSADM or SYSCTRL authority is not properly set for you. So it causes the issue.
If you ALTER any object from the Data Source Explorer or embedded SQL within an application, you must have ownership of the object and at least one of the following: ALTERIN privilege for the schema or all schemas. So SYSADM or SYSCTRL authority is needed.
Another issue, I want to say you to use updated Data Studio, Version 4.1.1 or more.
because, they give some additional features -
New and Changed Features for the Data Studio, Version 4.1.2
Eclipse SDK Uplift to ensure shell sharing with InfoSphere Data
Architect, Rational Application Developer and Rational Developer for
z/OS
New and Changed Features for the Data Studio, Version 4.1.1
Support for Fix Pack 4 for DB2 for Linux, UNIX and Windows v10.5. This
includes: The latest BLU capabilities, such as the ability to alter
BLU tables by adding columns.
For more, you can study -
Best practices when using Data Studio
What's New and Changed in IBM Data Studio Version 4.1.x
I've written a game which I intend to upload to the marketplace as a free demo, and I intend to offer a full version for a buck.
I'd like to make the download for the full version just a simple unlocker which writes a value to the SharedPreferences for the demo.
When the demo launches it reads its shared prefs and if the value is present then it runs in full mode, otherwise it runs in demo mode.
The reason for this is A) so that when people purchase the full version the download is close to instant instead of having to wait for the whole app to be downloaded again, and B) so that I don't have to update two market listings whenever I change the code for the app.
So, is it possible to alter the SharedPrefs for a package that is separate from the currently running package?
Android sharedpreferences for an application come in 4 modes.
MODE_PRIVATE is used the most and only internal to the app
MODE_WORLD_READABLE is used if you want your preferences to be
read by another application
MODE_WORLD_WRITEABLE is deprecated API 17 onwards.
MODE_MULTI_PROCESS can be modified by multiple processes.
When an application wants to write preferences,it is called by
Context.getSharedPreferences (String name, int mode).
So it is possible to read the preferences.But to write it that particular app should be using MODE_WORLD_WRITEABLE which is deprecated.
Moral:You cannot alter the preferences of other applications.
And you really should not want to do it either
I have an SQLite database stored in the assets resources of one application used to load UI and other stuff into the app, mainly just holding text nothing out of the ordinary. I want to be able to get a writable version of this database so I can modify it from another application.
Example:
First application is on the market with limited number of enabled features. User gets to a certain point where they need to buy extra content to do more stuff in the app. The original app has these features but they are not enabled in the app using the database. I want the user then to download a second app from the market which is just used to change one field in the database from disabled to enabled thus unlocking the new features.
I have an idea I may need to use content providers but my understanding is once created they are accessible to all applications. I need it, for piracy reasons I guess, to only be able to communicate with apps signed off by my key.
Thanks
Sam,
I understand what you intend to do, but you are going about it the wrong way. Your 'Unlock App' would not be able to modify the Database in the assets folder of your 'Free App'. That's just general android security model stuff.
You may want to look at this question: How can I use the paid version of my app as a "key" to the free version?
It describes how you can create a 'Unlock App' on the market to unlock features of your 'Free app' without needing to actually modify any of the original data in the 'Free App'.
Good luck