5
I created an app, I registered at the bank Sqlite, but when I create new functions for the application how do I update without uninstalling it?
Obs: no use Google Play, I install direct from Apk that I create.
5
I created an app, I registered at the bank Sqlite, but when I create new functions for the application how do I update without uninstalling it?
Obs: no use Google Play, I install direct from Apk that I create.
1
When you update your APK in the playstore your database will NOT be deleted. In your databasehelper class you will have a method onUpgrade(Sqlitedatabase db, int oldVersion, int newVersion) where oldVersion is the previous version of your database on the user device and newVersion is the new version.
Example
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
switch (oldVersion){
case 1;
//TODO alteras campos da vesao 1 para versão 2
break;
case 2;
//TODO alteras campos da vesao 2 para versão 3
break;
case 3;
//TODO alteras campos da vesao 3 para versão 4
break;
}
}
If you need to know the new version of the database to make the change use the variable newVersion
Browser other questions tagged android
You are not signed in. Login or sign up in order to post.
Change the app without updating it think you have no way, you need a way to update the APK (as occurs in the play store), give a look at the link that follows: How to make a manual system to check for new updates?
– user28595
i want to update it, but without uninstalling the application, do not want to lose the information in the bank
– Taha tsu
@Tahatsu take a look at the answer How to update a proprietary app?
– viana
No need to lose the information, only happens if you program to delete in the installation.
– GabrielLocalhost
How are you doing to create the Bank? .
– GabrielLocalhost
the bank must be in a device user folder.
– Daniel Omine
When you update you don’t lose the bank. Unless you uninstall the already installed application.
– Reginaldo Rigo
If you just install the apk "above" the previous version, practically an update doesn’t happen. Now if uninstall the app ai was already the bank, unless you did as @Danielomine said and the bank is in an "out" folder of the app, depending on the situation may not be a good idea, but it is an alternative.
– Neuber Oliveira
If you want to change the database, create columns or tables you should do Migration in your app, or write the script to give the "upgrade" in your database, you can use the Sqliteopenhelper that is already native on android, here there is an example.
– Marco Giovanni