Contents

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