Develop
2020.12.15 12:42
[kotlin] 코틀린 안드로이드 앱 버전/빌드 정보
Views 1000 Comment 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/
No. | Category | Subject | Author | Date | Views |
---|---|---|---|---|---|
781 | Develop | [swift] 실행시간 측정하기 | hooni | 2021.09.14 | 865 |
780 | Develop | [swift] UIView에서 subview 찾기 | hooni | 2022.12.09 | 2128 |
779 | Develop |
[swift] popToRoot 모달뷰, 네비게이션컨트롤러 한꺼번에 닫기
![]() |
hooni | 2021.01.29 | 1610 |
778 | Develop |
[swift] NotificationCenter 간단 예제
![]() |
hooni | 2021.01.27 | 8354 |
777 | Develop | [spring] 스프링 IoC/DI | hooni | 2013.04.23 | 11413 |
776 | Develop | [sh] 쉘스크립트 if 비교 연산 | hooni | 2020.05.26 | 61112 |
775 | Develop |
[sh] html 안에 있는 img 다운 받는 쉘 스크립트
![]() |
hooni | 2020.05.26 | 768 |
774 | Develop | [python][django] request.cookie 읽어오기 ㅋㅋㅋ (쓰기) | hooni | 2019.12.06 | 1850 |
773 | Develop | [python] 파이썬 공부하는 사이트~ | hooni | 2013.11.12 | 10898 |
772 | Develop | [python] 파라미터 앞에 *, ** 의 의미? (*args, **kwargs) | hooni | 2019.11.22 | 1710 |
771 | Develop |
[python] 애니팡, 캔디팡 매크로
![]() |
hooni | 2013.09.06 | 18215 |
770 | Develop |
[python] DJI Tello 드론 코딩 (프로그래밍)
58 ![]() |
hooni | 2018.03.04 | 28812 |