Contents

Views 821 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
13 Develop [c] home env stack overflow hooni 2003.04.23 11515
12 Develop [c] 파일입출력 간단한 설명 hooni 2003.04.23 11243
11 Develop [C] C언어의 조건 연산자(Conditional Operator) hooni 2003.04.23 14227
10 Develop [vb] 비쥬얼 베이직으로.. hooni 2003.04.23 52997
9 Develop [c] 재미있는 코딩.. file hooni 2003.04.23 21316
8 Develop [vb] 비쥬얼 베이직 기출 문제 연습2 hooni 2003.04.23 54338
7 Develop [vb] 비쥬얼 베이직 기출 문제 연습 hooni 2003.04.23 55134
6 Develop [vb] 비주얼 베이직 순위 정렬 루틴 hooni 2003.04.23 58316
5 Develop [vb] 비주얼 베이직 205페이지 hooni 2003.04.23 56037
4 Develop [vb] 비주얼 베이직 173페이지 hooni 2003.04.23 54802
3 Develop [vb] 비주얼 베이직 141페이지 hooni 2003.04.23 58904
2 Develop [vb] 비주얼 베이직 131페이지 hooni 2003.04.23 58043
Board Pagination Prev 1 ... 62 63 64 65 66 67 68 69 70 71 Next
/ 71