What is the best way of checking for my android application updates?

I have an android application created in android studio.
I want to check daily whether an update is available for my app or not. if yes, then notify user to download and install the update.


  1. it should send a request to my server to check for the newest version(e.g. https://my-site.com/get-app-info/newest-version)
  2. then it compares the version, if the version which is gotten from server was greater than current app version -> send a notification to user and ask them to update it


I searched a lot and I found many answers such as using these:

I faced some problems for example:

I want to know which one best suits my job. and how to do it.
thanks in advance.

Upvotes: 0

Views: 528

Answers (1)

tyczj
tyczj

Reputation: 73826

You should use WorkManager you can set it to run once a day and even only run when there is an internet connection.

In the work manager you would make a the call to check your app version then show a notification if there is an update.

Create the work manager somewhat like this

val constraints = Constraints.Builder().setRequiredNetworkType(NetworkType.CONNECTED).build()
val dailyBuilder = PeriodicWorkRequestBuilder<DailyMaintenanceWorker>(1, TimeUnit.DAYS).setConstraints(constraints) .build()
WorkManager.getInstance(this).enqueueUniquePeriodicWork("DailyMaintenanceWorker", ExistingPeriodicWorkPolicy.KEEP, dailyBuilder)

Upvotes: 1

Related Questions