Contents

조회 수 986 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄

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
번호 분류 제목 글쓴이 날짜 조회 수
93 Develop [coding] 공부해야 하는거 ㅋㅋ secret hooni 2017.06.27 0
92 Develop [android] 안드로이드 앱 문서 샘플 file hooni 2017.07.11 2219
91 Etc 캘리포니아 운전면허 문제 file hooni 2017.07.22 1174
90 System/OS [mac] Homebrew/rvm/cocoapod setting hooni 2017.07.29 1179
89 Develop [ios] VIN Scanner (VIN barcode) 스캐너 file hooni 2017.09.16 785
88 System/OS [linux] iptables 초간단 세팅 스크립트 hooni 2017.09.26 1401
87 Etc 영어. 불규칙 동사 정리 file hooni 2017.10.04 3656
86 Etc How to completely Uninstall Coda hooni 2017.10.24 2544
85 System/OS 무료로 HTTPS 적용하기 (Let's Encrypt) file hooni 2017.10.28 1690
84 System/OS OpenSSL로 ROOT CA 생성 및 SSL 인증서 발급하기 hooni 2017.10.28 1639
83 System/OS [mac] How to uninstall MySQL on Mac OS. hooni 2017.11.08 1046
82 Database [mysql] 중복데이터 삭제하는 초간단 쿼리 hooni 2017.11.22 3557
Board Pagination Prev 1 ... 86 87 88 89 90 91 92 93 94 95 ... 98 Next
/ 98