Develop
2020.12.15 12:42
[kotlin] 코틀린 안드로이드 앱 버전/빌드 정보
조회 수 969 댓글 0
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/
번호 | 분류 | 제목 | 글쓴이 | 날짜 | 조회 수 |
---|---|---|---|---|---|
1089 | System/OS | [linux] 텔넷, FTP 텍스트 모드에서 사용 | hooni | 2003.04.23 | 11989 |
1088 | System/OS | [linux] 이기종간의 파일 공유(Samba) | hooni | 2003.04.23 | 14946 |
1087 | System/OS | [linux] sendmail 설정/사용 | hooni | 2003.04.23 | 14628 |
1086 | System/OS | [linux] DNS(Domain Name System) 설치, 설정 | hooni | 2003.04.23 | 12502 |
1085 | System/OS | [linux] Masquerade 가상 ip분할기법 | hooni | 2003.04.23 | 47999 |
1084 | System/OS | [linux] DHCP(Dynamic Host Configuration Protocol) 서버 | hooni | 2003.04.23 | 13083 |
1083 | System/OS | [linux] 네트웍 트래픽 모니터링(MRTG) | hooni | 2003.04.23 | 42206 |
1082 | System/OS | [linux] 커널 컴파일, 설정 | hooni | 2003.04.23 | 17905 |
1081 | System/OS | [linux] 네트워크 커널 설정.. | hooni | 2003.04.23 | 16532 |
1080 | System/OS | [linux] 최소한의 커널 설정(커널설치 전체과정) | hooni | 2003.04.23 | 17465 |
1079 | System/OS | [linux] Xwindow/Xmanager 사용 | hooni | 2003.04.23 | 13381 |
1078 | System/OS | [linux] ipchains 옵션 | hooni | 2003.04.23 | 13686 |