Develop
2020.12.15 12:42
[kotlin] 코틀린 안드로이드 앱 버전/빌드 정보
조회 수 827 댓글 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/
-
[matlab] 정보은닉 스테가노그래피(Steganography) 수업
-
[apache2] Redirect HTTP to HTTPS
-
[ios] 비디오,네트워크,소셜로그인 테스트
-
[android] Android N requires the IDE to be running with Java 1.8 or later 오류
-
[Javascript][Ajax] 자바스크립트 강의 산출물
-
WM미통기 - 10. 조건부확률
-
[ios] Crashlytics, Fabfic 설치/설정
-
[ppt] iOS 플라랩#01(2015.02.26) 발표 자료
-
캘리포니아 운전면허 족보
-
[ios][swift] 초간단 TableView 샘플
-
[ios] 앱에서 설정화면 호출하기
-
리팩토링 계획안