Contents

조회 수 827 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄

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/



?

List of Articles
번호 분류 제목 글쓴이 날짜 조회 수
709 Develop [python][django] request.cookie 읽어오기 ㅋㅋㅋ (쓰기) hooni 2019.12.06 1694
708 Develop [php] mysql_ 과 mysqli_ 의 차이 hooni 2017.12.01 1697
707 Develop [swift] UIView에서 subview 찾기 hooni 2022.12.09 1792
706 Develop [ios] Xcode cannot run using the selected device hooni 2014.08.14 1796
705 Develop [iOS] Xcode 불필요한 캐시 삭제하기 hooni 2021.10.12 1803
704 Develop [iOS] 시뮬레이터에 푸시 알림을 보내는 방법 file hooni 2021.10.13 1830
703 Develop [ios] Objective-C 에서 자주 사용하는 수학 함수와 유용한 Define hooni 2014.08.08 1865
702 Develop [ios] 카메라 사용 권한 확인해서 분기하는 방법 hooni 2015.02.26 1875
701 Develop [php][laravel] 초간단 MacOS에서 Laravel 개발 환경 구축 hooni 2017.12.15 1886
700 Develop [android] 가속도 센서를 이용한 흔듦(Shake) 감지 file hooni 2014.11.04 1898
699 Develop [ios] 웹뷰 history.back() ㅋㄷ file hooni 2016.06.27 1906
698 Develop [matlab] ZigZag-Scanning (2-D Array) file hooni 2016.10.15 1994
Board Pagination Prev 1 ... 7 8 9 10 11 12 13 14 15 16 ... 71 Next
/ 71