Contents

Views 979 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
1089 Develop [js] jQuery 관련 문서 ㅎㅎ file hooni 2013.04.23 31255
1088 Etc 성문 종합 영어 정리된 pdf 파일 file hooni 2013.06.25 31212
1087 Develop [android] 디바이스(시뮬레이터) hosts 파일 수정하기 hooni 2013.04.23 31127
1086 Develop 서기의 PHP 동영상 강의(싱싱해) hooni 2013.05.15 31042
1085 System/OS [linux] 특정 문자열 포함된 파일 찾는 명령어 hooni 2013.10.16 30716
1084 Etc 영작 연습을 위한 실용영어 문장 1001개 (1~500) hooni 2013.06.21 30659
1083 Develop [js] 웹페이지에서 특정 엘리먼트 드래그, 복사, 컨텍스트메뉴, 키보드 막기 hooni 2013.11.04 30126
1082 System/OS [linux] 랜카드가 2개 일 때 네트워크 설정 hooni 2003.04.23 30123
1081 System/OS 맥북에서 MAC/윈도우 멀티부팅시 시간 설정 file hooni 2013.04.23 29862
1080 Develop [ios] 테이블뷰셀/뷰에 배경 패턴 넣기.. hooni 2013.04.23 29856
1079 Develop [ios] iCloud관련 저장 디렉토리 hooni 2013.04.23 29676
1078 System/OS [mac] OSX(맥) 단축키 설명 ㅎㅎ file hooni 2013.04.23 29662
Board Pagination Prev 1 ... 3 4 5 6 7 8 9 10 11 12 ... 98 Next
/ 98