Contents

Views 987 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
145 Develop [c] AES 알고리즘 (암호화/복호화) file hooni 2003.04.23 20145
144 Develop [c] 문자열 라이브러리 최신버전 file hooni 2003.04.23 7222
143 Develop [js] 주민번호 생성기.. file hooni 2003.04.23 8177
142 Develop [c] 문자열 컨트롤 함수로 만든 프로그램들.. file hooni 2003.04.23 6802
141 Develop [php] 메모장 - 웅지학원 ([c] mysql 백업프로그램 포함) file hooni 2003.04.23 7034
140 Develop [js] 가운데 새창 뜨는 함수와 이벤트 hooni 2003.04.23 6744
139 Develop [c++] Window API(MFC) 오목 게임 file hooni 2003.04.23 10318
138 Develop [java] 스윙(swing) 인터페이스 이용해서 만든 구구단.. ㅋㅋ file hooni 2003.04.23 6709
137 Develop [c] 프로그래밍 과제..(colprint) file hooni 2003.04.23 6774
136 Develop [php] 초간단 웹 카운터.. file hooni 2003.04.23 7128
135 Develop [jsp][php] LDAP 프로그래밍.. file hooni 2003.04.23 7415
134 Develop [c] C에서 MySQL DB 사용하기~ file hooni 2003.04.23 7040
Board Pagination Prev 1 ... 54 55 56 57 58 59 60 61 62 63 ... 71 Next
/ 71