Contents

Views 2806 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
1165 Develop 참고하고 지울 자료.. 집에서 바야지.. ㅋㅋ file hooni 2013.04.23 14093
1164 Etc 종합시험 관련 자료 secret hooni 2017.03.15 0
1163 Etc 정보시스템(정보보안)의 위험관리 설명 hooni 2013.04.23 20572
1162 Develop 정리할 자료. file hooni 2015.07.02 2089
1161 Develop 자주 쓰는 Docker 명령어 alias hooni 2020.01.10 289401
1160 Etc 인증서 *.p12 파일을 *.pem 파일로 변환 hooni 2015.04.30 3802
1159 Etc 이클립스(Eclipse) 유용한 단축키 ㅋㅋ hooni 2013.04.23 23198
1158 Develop 이어서 작업할 내용~ secret hooni 2013.11.21 0
1157 Develop 웹페이지 성능 테스트 툴 설명 hooni 2013.04.23 28443
1156 Etc 웹 보안 논문 주제 2016 secret hooni 2016.11.28 0
1155 Etc 원어민이 매일 쓰는 일상표현 150개 file hooni 2023.09.17 4872
1154 Etc 영작 연습을 위한 실용영어 문장 1001개 (1~500) hooni 2013.06.21 32019
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 ... 99 Next
/ 99