Develop
2020.12.15 12:42
[kotlin] 코틀린 안드로이드 앱 버전/빌드 정보
조회 수 962 댓글 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] 숫자만 입력하게 하는 자바스크립트
-
[c] 학교 건물 최단거리 찾는 웹 연동 프로그램
-
[php] 피코맥스용 검색엔진 ㅋㅋ
-
[js] ajax를 이용해 외부문서 불러오기..
-
[js] One Time Pad key generatorㅡ.,ㅡ;
-
[c] 파일 복사(copy) 프로그램 샘플 소스
-
[c] 문자열 컨트롤 함수로 만든 프로그램들..
-
[pdf] C 국제 표준 문서
-
[js] 실행되는 디렉토리 확인하는 스크립트..
-
[js] 한글문서로 된 259가지 자바스크립트 예제파일
-
[c] 프로그래밍 과제..(colprint)
-
[c] 시간 계산 하는 프로그램 소스코드