Contents

조회 수 2806 댓글 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
번호 분류 제목 글쓴이 날짜 조회 수
75 Develop [php][laravel] 라라벨 프로젝트 생성 및 구조 file hooni 2017.12.15 4598
74 Develop [php][laravel] 초간단 MacOS에서 Laravel 개발 환경 구축 hooni 2017.12.15 4597
73 Develop [ppt] iOS 플라랩#04(2015.06.19) 발표 자료 file hooni 2015.06.04 1549
72 Develop [python] DJI Tello 드론 코딩 (프로그래밍) 58 file hooni 2018.03.04 32592
71 Develop [python] 애니팡, 캔디팡 매크로 file hooni 2013.09.06 21419
70 Develop [python] 파라미터 앞에 *, ** 의 의미? (*args, **kwargs) hooni 2019.11.22 3782
69 Develop [python] 파이썬 공부하는 사이트~ hooni 2013.11.12 11832
68 Develop [python][django] request.cookie 읽어오기 ㅋㅋㅋ (쓰기) hooni 2019.12.06 3680
67 Develop [sh] html 안에 있는 img 다운 받는 쉘 스크립트 file hooni 2020.05.26 2557
66 Develop [sh] 쉘스크립트 if 비교 연산 hooni 2020.05.26 64335
65 Develop [spring] 스프링 IoC/DI hooni 2013.04.23 12384
64 Develop [swift] NotificationCenter 간단 예제 file hooni 2021.01.27 12757
Board Pagination Prev 1 ... 60 61 62 63 64 65 66 67 68 69 ... 71 Next
/ 71