Contents

Views 817 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
21 Develop [c] 소수점 반올림^^ hooni 2003.04.23 8478
20 Develop [c] 최대공약수 알고리즘 (유클릿) hooni 2003.04.23 8873
19 Develop [php] whois정보 조회 프로그램 hooni 2003.04.23 11733
18 Develop [c] 간단한 링크드 리스트(linked list) 자료형 예제.. hooni 2003.04.23 9839
17 Develop [c] CGI Library to C^^ hooni 2003.04.23 8422
16 Develop [c] scanf(), printf() 포맷의 형변환 hooni 2003.04.23 10856
15 Develop [c] home env stack overflow hooni 2003.04.23 11515
14 Develop [c] 파일입출력 간단한 설명 hooni 2003.04.23 11243
13 Develop [C] C언어의 조건 연산자(Conditional Operator) hooni 2003.04.23 14227
12 Database [mysql] 접속과 테이블 생성 간단한 설명.. hooni 2003.04.23 18655
11 Develop [vb] 비쥬얼 베이직으로.. hooni 2003.04.23 52997
10 Develop [c] 재미있는 코딩.. file hooni 2003.04.23 21316
Board Pagination Prev 1 ... 89 90 91 92 93 94 95 96 97 98 Next
/ 98