How to reuse an Android project to have two different APK - java

I have previously worked on a project using Android Studio. Now I want to start a new project, but with similar characteristics, so instead of re-starting the project, I have copy the folder, changing the name and made few functionalities.
Nevertheless, when I have built the APK, and tried to reinstall it, my device prompt the following message:
Do you want to install an update to this existing application? Your existing data will not be lost
Before pressing accept, I would like to know if this is going to remove the application that I had in my device with the first project that I was working with or not. If so, I would like to know how to do it, or at least how to avoid this issue.
I assume that it could be done by changing the id of the project, or any other simple solution, but it would be nice to double check

You need to change the application id (package name). Android uses such value to uniquely identify each existing app.
Every Android app has a unique application ID that looks like a Java package name, such as com.example.myapp. This ID uniquely identifies your app on the device and in Google Play Store. If you want to upload a new version of your app, the application ID (and the certificate you sign it with) must be the same as the original APK—if you change the application ID, Google Play Store treats the APK as a completely different app. So once you publish your app, you should never change the application ID.

Related

Updating java code from server

I have an app that has an activity which allow users to download PDF files by selecting a PDF and clicking the download button.
The issue is: I don't want to always ask users to update the app when there's a new material available.
Is there a way I can update the .java code without always asking users to update the app?
Wrong design point.
You have probably hardcoded the PDF / file names in your Java application.
When these values are supposed to change, then well: don't hardcode them.
Instead you create a server side service that lists the available PDFs. And then your app uses that service in order to acquire that information.
Anything that is "dynamic" must not be hardcoded in your app itself. Instead your app knows how to fetch that piece of information from somewhere.
When the source code of your application changes, your users have to upgrade the app. It is that simple. The other way round: if you know about "changes" to your app that need to work without upgrading the app, then well: you have to design the whole app around that requirement.
A first starting point / further reading: see here.

Can a Xamarin-android application be updated to native java android application?

I have an apk generate by xamarin android.I am trying to update that application using another apk generated from android studio(java).
Is it possible to update.
1. Using PlayStore.
2. OR Without Playstore.
It will be helpful if someone can explain about updating apk's and regulations from different platforms. I am not able to find any source for this kind of update. Thanks in advance.
As long as the package name and the certificate you use to sign is the same, the actual code in the APK doesn't matter. You could have an app, first created in unity, then updated with Xamarin, then Java and update it without issues, as long as you have the certificate and package.
So basically, as long as you use the same package name and certificate, you can update it even if it's running on a different framework/language/engine

Store data on device on application install without opening app

Is it possible to save data to a device upon the installation of my application prior to the opening of the application?
If not, I'm looking for a way I can somehow mark a mobile device as "test device" without my application ever being opened on it (only installed).
If you want to distinguish between the shipped devices and every other device, use the build variants. You can add a variable to the BuildConfig class in gradle and specify a value for this sort of "prerelease" you are making and other for the build you are shipping to the store. Then, in the relevant code, check the value of the variable you created in BuildConfig.

Java/Android - Best way to update apps that are not in the Play Store

I am installing security software/hardware into a couple different school districts. The application is at it's final stage, however I will need to send updates to users periodically. For example, a general password will be changed for the application every 6 months.
Installing an .apk is considered an "update" after the initial application is installed, correct?
I just have a feeling that there should be some easy way of doing this. I don't really want to give people an .apk. Someone could get smart and tear it apart to find the contents. That, and some others might not understand how to install files on their phone.
What are your ideas? Maybe a web link a user can go to that starts the install for them?
You have multiple misconceptions how updating, APKs and keeping keys secure work.
You have to host your APKs somewhere. Github releases is a pretty common way (but slow), but you could also use google drive, dropbox or your own server.
Your app has to fetch the server regularly and check if a new APK is available (pull-based). Second option is to use push notification in some kind e.g. FCM (push-based). Then you download the APK and let the user install it. Your app cannot start a installation by itself, it has to be done by the user.
But you can redirect the user to the installation menu with that APK, so he just has to click "Install". "Install from unknown sources" has to be enabled for that, if not the user will get an information about that from the OS with a way to enable.
There are apps like "APK extractor" which get you the APKs from google play without root, so there's nothing wrong about giving out the APK. Your APK should never contain secure keys which the user isn't allowed to see. It's easy to reverse engineer those keys, it's just a matter of time.

Upgrade multiple apps to one app

I currently have a few apps in the Play Store about different ships. Is there a way to upgrade all these apps to one consolidated app?
It is not quite possible to do what you want since all your apps use a different package name. As Henry suggested, you can update all your apps and tell the user to install the new app.
The other (not so recommended) option would be to create your consolidated app and generate a different apk for each app you already have on the Store, modifying only the package name. All the users will be able to have the consolidated app without the need to install a new app. However, it is a bad approach since you will have many copies of the same app in the store, which may lead you into troubles (not so easy to maintain and probably problems with Google).

Categories

Resources