Contents

Views 1000 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
73 Develop [ios] 코코아 프레임워크(Cocoa Framework) 기본적인 내용~ hooni 2013.04.23 27727
72 Develop [ios] Objective-C 특정 문자 찾아 제거하기 hooni 2013.04.23 28113
71 Develop [ios] DJBros. (DJ요맨~) file hooni 2013.04.23 28142
70 Develop [c] C로 구현한 CGI - 계산기 (링크리스트, 스택, 이진트리) file hooni 2003.04.23 28160
69 Develop [c++] mfc 파일 한줄씩 읽기.. ㅋㅋ hooni 2013.04.23 28658
68 Develop [js] JSON 컨트롤.. 재귀호출로 값 출력하기 hooni 2013.04.23 28682
67 Develop [python] DJI Tello 드론 코딩 (프로그래밍) 58 file hooni 2018.03.04 28812
66 Develop [ios] NSMutableString 문자열 패턴 교환 hooni 2013.04.23 29028
65 Develop [ios] Objective-C 문자열 잘라서 배열(NSArray)에 넣기 hooni 2013.04.23 29459
64 Develop [ios] 소소한 팁 (Rect,Point,Path,URL 등) hooni 2013.08.08 29535
63 Develop [ios] iCloud관련 저장 디렉토리 hooni 2013.04.23 29679
62 Develop [ios] 테이블뷰셀/뷰에 배경 패턴 넣기.. hooni 2013.04.23 29861
Board Pagination Prev 1 ... 60 61 62 63 64 65 66 67 68 69 ... 71 Next
/ 71