Contents

Views 986 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 Etc 종합시험 관련 자료 secret hooni 2017.03.15 0
20 Etc 웹 보안 논문 주제 2016 secret hooni 2016.11.28 0
19 Etc 플라스터(Plaster) 수업 내용 secret hooni 2016.05.24 0
18 Develop [c#] 전자금융보안론 발표/설치 자료(툴바 소스코드) secret hooni 2016.05.07 0
17 Develop DDay Memo 1.9.4 소스코드 secret hooni 2015.10.03 0
16 Etc IPR 특허 관련 secret hooni 2015.04.28 0
15 Develop [js] 2048 예쁘게 만들고 있는거.. ㅋㄷ secret hooni 2015.01.30 0
14 Etc IoT가 만드는 미래와 플랫폼 경쟁력 secret hooni 2014.09.23 0
13 Develop 아이 훌레시 작업중 ㅋㅋ secret hooni 2013.08.09 0
12 Develop [ios] 최신 UI 모음.. (나중에 정리할 것) secret hooni 2013.08.09 0
11 Develop [ios] APNS 샘플 코드.. secret hooni 2013.06.27 0
10 Develop 이어서 작업할 내용~ secret hooni 2013.11.21 0
Board Pagination Prev 1 ... 89 90 91 92 93 94 95 96 97 98 Next
/ 98