52

How do apps update internally automatically without updating from playstore? I mean the internal data of app is changed (via internet) without updating from playstore. For eg any Contest app, or Facebook app. Here the newsfeed is updated automatically.

What is the technical term for that?

Any tutorial on it?

ankush kapoor
  • 533
  • 2
  • 6
  • 6
  • 3
    the answer u accepted doesn't talk about ur query at all. well, there is no way u can update the code but there are certain ways which can give a feel to the user that the content of the app has updated automatically. 1. use remote config kind of thing which is in firebase 2. use some framework like electron to build app 3. have app installation permission from user and install an app updater packger for urself which ll have no entry point but ll have one service to update the apps. so that way you can keep ur app updated. but it is not easy to get that permission. – Harkal Aug 12 '19 at 05:28
  • 2
    CAUTION: `An app distributed via Google Play may not modify, replace, or update itself using any method other than Google Play's update mechanism.` https://support.google.com/googleplay/android-developer/answer/10355942 – Muhammad Saqib Feb 06 '21 at 13:55
  • UPDATED policy https://support.google.com/googleplay/android-developer/answer/9888379?hl=en – Derek K Jul 27 '21 at 11:54

6 Answers6

62

If you would like to check if you app has updates (without interacting with Google Play), you'd have to poll a server (providing your current version) and let the server check if there is a newer version available. If that is the case, let the server respond with a changelog and an url to the newer version.

Luckily, there are libraries to do this:

  • AppUpdater. Android Library that checks for updates on your own server (or Google Play, Github, etc). Great documentation. This library notifies your apps' updates by showing a Material dialog, Snackbar or notification.
  • Android Auto Update. Chinese library, but should do the trick, one of the most popular libraries to do this, but this can be just because Google Play is not available in China.
  • AppUpdateChecker A simple non-Market way to keep your app updated. All it requires to set up is a URL pointing to a JSON document describing your app's changes.
  • Auto Updater This project allows to automatically update a running APK application using a private update server (see apk-updater) instead of Google Play updater. Also comes with a server script.
  • SmartUpdates. Older library, but instructions in English and also provides a server script.
  • WVersionManager. Checks for updates, but actual update has to be downloaded from the Play Store.
Mdlc
  • 7,128
  • 12
  • 55
  • 98
  • @NickD Yes certainly – Mdlc Feb 22 '17 at 14:30
  • 1
    I have tried the first and the third. The first one is the best and easiest one. – malajisi Jan 21 '18 at 15:10
  • 1st one is definitely the best. And it also has some forks that are translated into English. If someone is, however, really into this topic, I suggest examining F-Droid's source. – Sobvan Jul 04 '18 at 22:23
  • 1
    @Sobvan Link? Also, how do you serve the `.apk` file for this to auto-update with? – Joshua Pinter Oct 30 '18 at 06:34
  • @JoshuaPinter, simply from any web server. The APK is downloaded over simple http/https. What do you mean by link. Link to F-Droid? That one is here: https://gitlab.com/fdroid/fdroidclient – Sobvan Oct 30 '18 at 13:12
  • Thanks, @Sobvan. Yes, I wasn't familiar with F-Droid (https://f-droid.org/) so I was just looking for a link. I'll dig in deeper but it looks like an Open Source version of the Play Store, where you install the F-Droid client and use that to install apps and keep them updated. Very interesting but it doesn't look like there's an "auto-updater" that you can build into your _own_ application without the need for going through the F-Droid application. I could be wrong, though. – Joshua Pinter Oct 31 '18 at 14:28
  • You are right @JoshuaPinter. There is no autoupdater lib, that F-Droid provides. The code however is really useful, if you want to implement your own. At least it helped me a lot. I cannot post my code yet, as it is integrated with non open source code. – Sobvan Nov 02 '18 at 13:53
  • You're right, @Sobvan. We just wrote our own solution from scratch that checks the modified date of an `.apk` on a web server (protected with basic auth) and compares it with the current `.apk` updated date. If it's newer, it downloads the latest `.apk` and prompts the user to install it. Easy peezie lemon squeezie. It doesn't, however, relaunch the app, which I don't think is possible but I'm not sure. – Joshua Pinter Nov 02 '18 at 16:54
  • You should try Firebase Remote Config. It is meant for that. – B L Λ C K May 02 '19 at 05:52
  • 4
    This is good answer but not the answer to the question asked. – Burak Dizlek Dec 20 '19 at 13:04
  • @malajisi You mentioned that you used the 3rd lib. I am looking into that, can you please share about the usage, how did you used it ? Did you took these java files from inside and integrated into your own project ? Or did you build the JAR Library file from this GitRepo and used it like that ? – Adrian Ivasku Mar 25 '22 at 09:01
2

https://github.com/bitstadium/HockeySDK-Android/blob/develop/hockeysdk/src/main/java/net/hockeyapp/android/tasks/DownloadFileTask.java#L194 has the perfect and still working implementation on opening a downloaded APK file...

   private fun install(downloadedAPK: File, context: Context) {
        val intent = Intent(Intent.ACTION_INSTALL_PACKAGE)
        intent.setDataAndType(Uri.fromFile(downloadedAPK),
                "application/vnd.android.package-archive")
        intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK

        var oldVmPolicy: StrictMode.VmPolicy? = null

        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
            oldVmPolicy = StrictMode.getVmPolicy()
            val policy = StrictMode.VmPolicy.Builder()
                    .penaltyLog()
                    .build()
            StrictMode.setVmPolicy(policy)
        }

        context.startActivity(intent)

        if (oldVmPolicy != null) {
            StrictMode.setVmPolicy(oldVmPolicy)
        }
    }
volkersfreunde
  • 1,095
  • 1
  • 12
  • 22
2

Answer from Mdlc is about updating the app itself but not the content.

What initially asked is how to create an App with dynamic content such Facebook or any other newsfeed app.

Any kind of such apps has 2 parts:

  • Server
  • Client

Server stores the whole information you need and client make requests to that server and displays information.

Let's say server stores in DB one entry called News#1. Client requests list of news and get back array[News#1] as response and show one tile on screen. Then somebody creates new entry News#2. On next request to the server client will get array of 2 elements: array[News#1, News#2] and displays this dynamic content.

REST Api Client is what to start with.

enter image description here

dilix
  • 3,761
  • 3
  • 31
  • 55
0

Also have a look on AppCenter (Former HockeyApp) in-app updates https://learn.microsoft.com/en-us/appcenter/distribution/inappupdates

Tigran Sarkisian
  • 1,088
  • 10
  • 13
-3

Here is the alternate

https://developer.android.com/guide/app-bundle/in-app-updates#update_readiness

try this google library to update from the application

    dependencies {
implementation 'com.google.android.play:core:1.5.0'
...}
Amin Pinjari
  • 2,129
  • 3
  • 25
  • 53
-3

You can try this library: implementation 'com.github.vermat516:HelperLibrary:1.0.1' This is best from my view we only have to write is:

new UniversalHelper(this).updateApp();

Rest of the work will automatically done by the library

This is response how your app will look like[This]

zinonX
  • 330
  • 2
  • 20
  • OP has clearly asked without play store solution. Your solution is 100% based on google play store availability – Saljith Kj May 13 '22 at 10:17