Contents

Views 986 Comment 0
?

Shortcut

PrevPrev Article

NextNext Article

Larger Font Smaller Font Up Down Go comment Print
?

Shortcut

PrevPrev Article

NextNext Article

Larger Font Smaller Font Up Down Go comment Print

How to Get App Version Name in Kotlin Android

Sometimes we have to get the current App version in Android to send it to our server or to show App update popup. You can use the following method to get the App Version Name in Kotlin Android.

fun GetAppVersion(context: Context): String {
var version = ""
try {
val pInfo = context.packageManager.getPackageInfo(context.packageName, 0)
version = pInfo.versionName
} catch (e: PackageManager.NameNotFoundException) {
e.printStackTrace()
}

return version
}

This is how you can call this method.

val versionName = GetAppVersion(this)

It will return the App version name in the form of “1.0” etc.



[출처] https://handyopinion.com/how-to-get-app-version-name-in-kotlin-android/



?

  1. [linux] CentOS Apache 웹서버에 HTTPS 적용

    Date2015.10.23 CategoryDevelop Byhooni Views920
    Read More
  2. [linux] CentOS Apache Httpd에 https 적용

    Date2014.03.05 CategorySystem/OS Byhooni Views4591
    Read More
  3. [linux] CentOS 6.x Cati 설치 (yum)

    Date2014.01.17 CategorySystem/OS Byhooni Views48660
    Read More
  4. [linux] CentOS 6.5 에서 "Bringing up interface eth0: Determining if ip address 121.78.127.197 is already in use for device eth0..."

    Date2014.04.05 CategorySystem/OS Byhooni Views4964
    Read More
  5. [linux] awk 명령어

    Date2014.03.11 CategorySystem/OS Byhooni Views5043
    Read More
  6. [linux] APM(apache, php, mysql) + gd 설치순서..

    Date2003.04.23 CategorySystem/OS Byhooni Views18943
    Read More
  7. [linux] apache, php, jsp 환경설정하기..

    Date2003.04.23 CategorySystem/OS Byhooni Views15314
    Read More
  8. [linux] /etc/fstab 설정 방법.. ㅋㅋ

    Date2013.04.23 CategorySystem/OS Byhooni Views12160
    Read More
  9. [link] 유용한 사이트 링크.

    Date2013.08.19 CategoryEtc Byhooni Views74026
    Read More
  10. [link] iOS(아이폰) 개발 관련 ㅋㅋ

    Date2013.04.23 CategoryEtc Byhooni Views21548
    Read More
  11. [lego] 세그웨이 이것만 볼것.. ㅎㅎ

    Date2013.04.23 CategoryDevelop Byhooni Views33583
    Read More
  12. [kotlin] 코틀린 안드로이드 앱 버전/빌드 정보

    Date2020.12.15 CategoryDevelop Byhooni Views986
    Read More
Board Pagination Prev 1 ... 29 30 31 32 33 34 35 36 37 38 ... 98 Next
/ 98