Develop
2020.12.15 12:42
[kotlin] 코틀린 안드로이드 앱 버전/빌드 정보
조회 수 2804 댓글 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] Text 값을 클립보드에 복사하기
-
[matlab] 정보은닉 스테가노그래피(Steganography) 수업
-
ZBar 라이브러리를 이용한 바코드 스캔 앱 개발하기
-
[web] 더 빠른 웹을 위한 프로토콜, 'HTTP/2'
-
[ios] 스크린 캡쳐 (전원버튼 + 홈버튼) 호출 알아내기
-
[sh] html 안에 있는 img 다운 받는 쉘 스크립트
-
[c] FSN 온라인 코딩 테스트 (Sorting, Binary Search)
-
'2014 모바일 개발 트렌드' 발표자료입니다.
-
[c] 파일명 또는 특정 패턴을 적용
-
[c] 기막힌 정렬 코드 ㅋㄷ
-
[ios] 오브젝티브C→스위프트, 코드 변환 손쉽게
-
[ios] Crashlytics, Fabfic 설치/설정