Contents

Views 978 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/



?

List of Articles
No. Category Subject Author Date Views
709 Develop [matlab] 정보은닉 스테가노그래피(Steganography) 수업 file hooni 2016.10.03 784
708 Develop [matlab] ZigZag-Scanning (2-D Array) file hooni 2016.10.15 2109
707 Develop [linux] 프로세스 관련 시스템콜 hooni 2003.04.23 7871
706 Develop [linux] 임베디드 리눅스 (embedded linux) file hooni 2013.04.23 7382
705 Develop [linux] 쉘 스크립트를 이용한 BBS hooni 2003.04.23 10080
704 Develop [linux] 날짜나 파일의 내용으로 검색하는 방법(find 명령 사용) hooni 2013.04.23 8148
703 Develop [linux] tar 명령어 뽀개기.. ㅋㅋ hooni 2003.04.23 7788
702 Develop [linux] crond 사용법.. ㅋㅋ hooni 2013.04.23 7271
701 Develop [linux] CentOS Apache 웹서버에 HTTPS 적용 hooni 2015.10.23 914
700 Develop [lego] 세그웨이 이것만 볼것.. ㅎㅎ file hooni 2013.04.23 33577
» Develop [kotlin] 코틀린 안드로이드 앱 버전/빌드 정보 hooni 2020.12.15 978
698 Develop [js]모바일 웹에서 orientationchange hooni 2013.04.23 19429
Board Pagination Prev 1 ... 7 8 9 10 11 12 13 14 15 16 ... 71 Next
/ 71