Develop
2020.12.15 12:42
[kotlin] 코틀린 안드로이드 앱 버전/빌드 정보
조회 수 2809 댓글 0
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/
-
도메인 관련 솔루션 분석할 거.. ㅋㄷ
-
[js] 윤동이가 만든 영어 학습(?) 프로그램
-
[php] 빔 프로젝터 예약 프로그램.. ㅋㅋ
-
[c] 프로세스간의 통신(파이프)
-
[php] 논문 관리 프로그램.. ㅋㅋ
-
[js] 숫자만 입력하게 하는 자바스크립트
-
[c++] 템플릿(Template) 예제 소스..
-
라이브러리에 대한 설명 (static & dynamic library)
-
[web] 웹 연동 프로그램 모음..
-
[c++] template 사용예
-
[c++] mfc로 만든 인테리어 수납 시스템(2D기반 설계)
-
[js] 양원님이 공유해 주신 유료(5$란다ㅋ) 자료 ㅋㅋ