Contents

Views 987 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
145 Develop [c++] 인라인 함수 설명과 예제.. file hooni 2013.04.23 6670
144 Develop [c++] 윈도우 프로세스뷰어 분석.. ㅋㅋ file hooni 2013.04.23 8868
143 Develop [c++] 윈도우 API 정복 예제 file hooni 2013.04.23 7634
142 Develop [c++] 웹폼(webform)전송과 http 파일 업로드 샘플 file hooni 2013.04.23 33114
141 Develop [c++] 압축프로그램(Lite Zip) 샘플 file hooni 2013.04.23 8631
140 Develop [c++] 쓰레드(Thread) 객체의 사용 hooni 2013.04.23 8609
139 Develop [c++] 소켓 프로그래밍 관련 링크.. (퍼올려고 올린거) hooni 2013.04.23 7064
138 Develop [c++] 바탕화면 테두리에 자석처럼 붙는 스냅효과.. file hooni 2013.04.23 8932
137 Develop [c++] 문자열 뒤집기(문자열 거꾸로 출력) hooni 2013.04.23 17320
136 Develop [c++] 마방진 소스코드 file hooni 2013.04.23 9570
135 Develop [c++] 링크리스트(linked list) 클래스(스택,큐) file hooni 2003.04.23 9595
134 Develop [c++] 레지스트리 편집하는 부분..ㅡㅡ; file hooni 2013.04.23 8304
Board Pagination Prev 1 ... 54 55 56 57 58 59 60 61 62 63 ... 71 Next
/ 71