Self-developed mechanism of updating the app when there is no google play store

Tram Ho

Currently most applications are distributed via google play store, but for some reason that you do not use this distribution and still want to be able to update the app when needed, then you have nothing worry because we can completely build an update mechanism for such apps.

Basically updating the app when not using the google pay store will include the steps

  1. Upload the new apk version to the server
  2. Notice of new version
  3. App check with new version will display the update screen with the content related to the update
  4. App download apk and install

Whenever you have a new version of the app, you will need to follow the steps above.

And now let’s go in step by step

1. Upload the new apk version to the server

This part, depending on you can build the server to save the file or as myself will choose to upload the apk file to github quickly.

The photo below is an example:

https://github.com/dangquanuet/wifi-hunter-public/blob/develop/apk/wifi-hunter-code-2-name-1-0-1.apk

Note: with github, you need to download the apk to get the exact link containing the file and provide it to the app,

In the above example, the link to download the file is

2. Notice of new version

There are many ways to do this like

  • Building a server with api returns new version information
  • Use Firebase remote config to return new version information

Information about the new version should include some basic fields such as

  • version code
  • version name
  • apk url
  • release notes

3. App check with new version will display update screen with content related to the update

In the app you will need to implement the new version check, maybe doing it every time you open the app will check the current version of the app compared to the version code app update on the server.

If the current app code version is smaller than the server code version, you can proceed to the force update app screen.

The force update app screen should display the most basic information about the new verson and button so that users can decide whether to update the app right away or not.

4. App download apk and install

When users click update app, you will do the following

  • Config AndroidManifest.xml

You need to ensure runtime permission for devices running Android 6 and above, can refer to how to quickly request runtime permission here

https://github.com/dangquanuet/The-Movie-DB-Kotlin/blob/develop/app/src/main/java/com/example/moviedb/utils/PermissionUtils.kt

  • Download new apk from url to device

  • Listen when the download is done via the receiver

  • Display pop up app settings:

Note : To be able to install apps from apk, you need to make sure the user has enabled setting to allow installing apps from unknown sources:

  1. Go to your phone’s Settings
  2. Go to Security & privac y> More settings
  3. Tap on Install apps from external sources
  4. Select the browser you want to download APK files from
  5. Toggle Allow app installs ON

So you’ve installed a mechanism to update the app without going to the google play store 😃

See you in the next posts.

Share the news now

Source : Viblo