Force user to have the latest version of an app - android

Is it possible to check on startup of an Android app whether the user has the latest version of it and force him to update if he has not?
Or at least checkt whether there is a new version and tell him, that the app only will work again when he downloads and installs the update?
Background is that I have an app that needs to communicate with a server. When I change something in the interface between server and client I want to assure that the client has the latest version.
Is there any native way to do this? Or do I have to check this on my own?

I don't think there is a native way to do this -- but coding it yourself shouldn't be too hard ; you'll have to :
Implement a version check : make a request to your server, and have your server return the last version number
Then, if the version number gotten from the server is higher that the application's one, ask the user to update.
You could even do this at each request -- just include the version number in each response from the server.
Might be useful in case the user resumes the application, instead of re-starting it from your "first" activity.

Related

How to send update to a mobile app (Android & IOS)

I've a made a really basic chat application(no need to see the code)(from the course of Angela Yu, flutter)it is integrated with google firebase which uses firebase_core, firebase_auth & cloud_firestore packages for authentication and uploading chat data in cloud Firestore.
I've installed the app through debug.APK( 1. would it matter if it was release.APK?) in my & my friend's phone both android ( let's take a neutral approach i.e the phone could be either IOS or Android).
What I aim is if I change my code( or we say update my app) I would want my app on both the phones to get updated( either automatically if possible or send a alert when user opens the app to update it), all this should be done with free of cost. 2. How can I achieve this in simplest manner?. I know there is a standard way for this if the app was in Google play store or App store but I don't want to upload it on stores.
My guess for this is that we integrate our app with a server so that every time the app starts it checks for a update with the server and ask the user to update and gets updated. If this is achievable can someone please guide me with these two methods mentioned below:
3(A). through free online server( can we use github or firebase?)
3(B). and can I make my own laptop as the server and code the app such that it doesn't need the server to be always online.( as in if my server is online it checks for update else it continues)
3(C). through paid servers ( just for information)
(4) Also please tell me why we chose cloud firestore over real time database for a chatting application?
(I don't want to create a web app)
I've no idea how would any of this be achievable like nothing like what server would be used or is this even possible. So please help me with a detailed explanation on all( 1,2,3(A),3(B),3(c) ). Any help would be really appreciated!
Since you already use Cloud Firestore, consider creating a document in there with a field that contains the version number of the latest app release.
In your application code you then read this document upon startup, and check it against the app's own version. If the version from the database is newer, tell the user to upgrade.
You could even include instructions on where/how to get the latest version in the database too. That can come in really handy of you suddenly have to change your release mechanism in between versions.

Caching server for Android or some thing similar

Our Android app will be used in a place without internet. We have one server with limited internet there.
Can user download the app from the server instead of google play, the way we can use ios cache server?
If we keep a copy of app in the server and install from it, how can we update the app with latest version?
Thanks.
You can host the apk file on the server and download it to the devices for installation. However, you first need to enable third party source installation for the devices.
Link how to here,
https://www.cnet.com/how-to/how-to-enable-third-party-app-installation-on-most-android-phones/
In terms of the update, you can always update the apk file anytime but you might need a separate system to notify the users/devices about the update. Probably by using SMS.

Update android application using OTA

I am having my own apps store where all android applications are hosted. Some apps are modified. So How i can send updates to clients/users using OTA. So clients will come to know about new updates and he will be able to download it.
Found an interesting solution on HN a month back. This is related directly update the app on the client without any user interaction. And since you have your own app store, shouldn't face any problems as listed in the HN thread.
The solution working snippets from the website-
...intercepts all calls to startActivityForResult, getResources, and some other functions. When you try to start an activity, Evolve generates a dummy class and sets its superclass to the activity you want to start.
...dynamically generates the bytecode for a new class
...then changes the intent to start the appropriate class
This is still in alpha mode, so would require some effort from your side to integrate.
Link to solution - http://blog.vivekpanyam.com/evolve-seamlessly-deploy-android-apps-to-users
Assuming this is what you are expecting, hope this helps!
1.Create a Web Service which your app can poll whenever the app launches or based on some time limit that can check if there is new version out there.
2.This Web service should return the lastest Version of the apk file that is hosted on the Server along with the URI of the application file that has the new version.
3.When your app gets the response from the Web Service, it will parse the JSON and check your app version to the lastest version that is available on the server.
4 If your app version is lower than the latest version it will prompt the user to start the download process.
5.The download of the new app is handled by the Download Manager.
The download manager will notify your app using Broadcast receiver when the download is complete.
6.Upon completion of the latest version of the application file the you can start the activity to install that file.
At this point user needs to say OKAY, lets do it.
Check this https://code.google.com/p/auto-update-apk-client/
If you have your own app store, then you must have a client app running on the relevant devices that allows them to install/update apps from that app store.
As part of that client, you can have a service, that enumerates the installed apps on the device and checks with your store whether updates are available. If yes, then it presents the user with a prompt to visit the store to update the corresponding apps - or do whatever else is appropriate in the situation.
You may also want to register this service to receive broadcasts of network connection events so that if there is no internet connection, the service will receive a notification when the connection is available again.

Prevent data loss on app upgrade

We have developed an Android application and pushing the new installations & updates through MDM (Mobile Device Management, Soti Mobi control). The update sent, silently upgrades the application without user's confirmation. Due to this, if application is in use by the users, is automatically stopped, upgraded & started from the beginning and thus users loose their important changes which they were suppose to send to server.
Is it possible in the mobi control to configure an update with a prompt to the user (similar to what it comes when we manually upgrade to the newer versions' APK)?
OR
Can I override any life cycle method which would be invoked on upgrade event, and if users' changes available I would like to abort the update?
Android MDM protocol (called Device Admin) doesn't have API to install/uninstall/upgrade applications.
So, pushing an upgrade isn't build-in Android feature, but rather a feature of Soti Mobicontrol application. I think, it make sense to contact them with this question.

Detect my own app's version or use existing update notifier when publishing on my website and not the market

I would like to notify the users when there is an update because the updates will be coming from my own website and not the market. However, do not want to have to update two places.
Either that or I would like to share the existing update notifier that is included with android. I am planning on uploading the app to one of our websites instead of the market.
Thanks!
AFAIK there is no public API for this provided by the Android OS or by the Android Market app. Note that hardware vendors often bundle their own update apps for this very reason.
Your best bet is to put the APK on your web server for download. Every time you download it, record the date from the Last-Modified HTTP header. Then in future you can poll this file using If-Modified-Since if your server supports this tag, if it doesn't you can get the header and check the Last-Modified date programmatically without downloading the HTTP contents.
Once you know an update is available, you can notify the user with your own notification code. If you plan to update the app programmatically, you will need to make sure you request the android.permission.INSTALL_PACKAGES permission in your manifest.

Categories

Resources