Contents

Views 2810 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. [swift] NotificationCenter 간단 예제

    Date2021.01.27 CategoryDevelop Byhooni Views12783
    Read More
  2. [kotlin] 코틀린 안드로이드 앱 버전/빌드 정보

    Date2020.12.15 CategoryDevelop Byhooni Views2810
    Read More
  3. [ubuntu] 우분투 18.04에 PHP5 설치하기

    Date2020.11.14 CategoryDevelop Byhooni Views3731
    Read More
  4. [js] Text 값을 클립보드에 복사하기

    Date2020.10.10 CategoryDevelop Byhooni Views2734
    Read More
  5. [sh] 쉘스크립트 if 비교 연산

    Date2020.05.26 CategoryDevelop Byhooni Views64346
    Read More
  6. [sh] html 안에 있는 img 다운 받는 쉘 스크립트

    Date2020.05.26 CategoryDevelop Byhooni Views2565
    Read More
  7. [ios] Start developing your navigation app for CarPlay without enrollment

    Date2020.02.22 CategoryDevelop Byhooni Views132744
    Read More
  8. [php] 3 Ways to Detect Mobile or Desktop in PHP

    Date2020.01.28 CategoryDevelop Byhooni Views7606
    Read More
  9. 자주 쓰는 Docker 명령어 alias

    Date2020.01.10 CategoryDevelop Byhooni Views289497
    Read More
  10. [python][django] request.cookie 읽어오기 ㅋㅋㅋ (쓰기)

    Date2019.12.06 CategoryDevelop Byhooni Views3685
    Read More
  11. [python] 파라미터 앞에 *, ** 의 의미? (*args, **kwargs)

    Date2019.11.22 CategoryDevelop Byhooni Views3786
    Read More
  12. 링크들 보고 지울 내용

    Date2019.11.21 CategoryDevelop Byhooni Views0
    Read More
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 ... 71 Next
/ 71