Install new apk without uninstall existing app

Is that possible to install a new apk without first uninstall same existing app? instead of of replace the existing app, then the database will not be deleted.

Thanks
Teo

Depends. If you change the version number of the database then you must uninstall the app. If you’re changing the the database then you’ll need to migrate inside the app.

I never change version number in either database and app (phonegap) itself. Before 7.4.2.0, it is able to overwrite just app itself, then i still keep the data in the database.
this may be kind of “security” feature on new phonegap compile. Just wonder if i can turn off this feature

Thanks
Teo

I’ve noticed the same issue since 7.4.2.0. No database, just sample program code. Maybe the new phonegap is incrementing the version number? I’m researching some other phonegap sample program issues and will post soon -

So I just went through this… we’re getting ready for a version bump and that required some changes to the database.

We made one change to the following code - we changed 1.0 to 1.5 and when we did this, the new app would NOT install until we deleted the old app.

  window.serDB = window.openDatabase("myTable", "1.5", "myTable", 2 * 1024 * 1024);

We had to rethink that strategy.

The other thing you could be encountering is navigating back and forth between debug (unsigned) android build and a signed build. Doing this requires you delete the existing install before installing the new version.

We’re seeing the same here and have also been looking for a solution. Right now, we need to delete each time before installing a new build.

We’re not alone. See this thread on the Adobe PhoneGap forum:
https://forums.adobe.com/thread/2644168

What you need to do is make a signed version of your app. Information on signing your app is here:
https://wiki.appstudio.dev/Submitting_to_the_Google_Play_and_Amazon_Stores

Because I generally build signed apps and only do developer builds when I need to debug via the chrome console I’ve never run into this. Signed apps seem to install fine.

Here’s what I believe has happened. The new version of AppStudio uses PhoneGap’s cli-9.0.0 version, which required by Google for apps. It uses the current Android API, which is more restrictive in what unsigned apps are allowed to do.

I thought of a couple of security holes this plugs. Suppose a user has an unsigned app. It saves information about the user in device storage - in local storage or in a database. Another developer could make a new app with the same name and fool the user into installing it. If the old app is not deleted first, the new app will have access to all its data.

Worse, if the old app had permissions to access stuff like Contacts, the replacement app would inherit those permissions.

By forcing a delete of the unsigned app before a new version is installed, this security hole is fixed.

Google has done the right thing here - one might ask why it took so long. It’s time to start signing your apps by default.