Contents

Views 817 Comment 0
?

Shortcut

PrevPrev Article

NextNext Article

Larger Font Smaller Font Up Down Go comment Print
?

Shortcut

PrevPrev Article

NextNext Article

Larger Font Smaller Font Up Down Go comment Print

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
No. Category Subject Author Date Views
777 Develop [c] 패스워드 암호화/사용자 정보 보기 file hooni 2003.04.23 7014
776 Develop [js] 큐 형식으로 배열사용.. ㅋㅋ hooni 2013.04.23 7014
775 Develop [c] 단어 입력/수정 프로그램 소스 file hooni 2003.04.23 7016
774 Develop [c] 정사각배열의 서브 배열의 최대 값 구하기 file hooni 2003.04.23 7016
773 Develop [c] openssl 샘플코드.. 어려움 ㅠㅠ file hooni 2013.04.23 7020
772 Develop [c] 내가 만든 암호화 프로그램.. 좋아^^ file hooni 2013.04.23 7021
771 Develop [c++] 소켓 프로그래밍 관련 링크.. (퍼올려고 올린거) hooni 2013.04.23 7029
770 Develop [C++] 18일차 과제물, String 클래스 디자인 【 C++ 문제 】 hooni 2013.04.23 7042
769 Develop [c] 텍스트 파일(로그)을 정해진 라인 단위로 쪼개주는 코드 file hooni 2013.04.23 7046
768 Develop [c++] mfc 기반 멀티수납(wall)시스템 소스와 실행파일 file hooni 2013.04.23 7052
767 Develop [js] 툴팁.. 좋은거.. (tooltip) file hooni 2013.04.23 7058
766 Develop [c] 구조체/파일 입출력 프로그램 file hooni 2003.04.23 7063
Board Pagination Prev 1 ... 29 30 31 32 33 34 35 36 37 38 ... 98 Next
/ 98