Skip to content

Instantly share code, notes, and snippets.

@arifNislam
Last active October 15, 2018 14:09
Show Gist options
  • Save arifNislam/494f7ae5cadf12ceac5e8e0a5241b01d to your computer and use it in GitHub Desktop.
Save arifNislam/494f7ae5cadf12ceac5e8e0a5241b01d to your computer and use it in GitHub Desktop.
Application information in multi-module android project
class AppInfoActivity : AppCompatActivity() {
private val tag = javaClass.simpleName
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
Log.d(tag, "Application Id: ${applicationInfo.packageName}")
val packageInfo = packageManager.getPackageInfo(applicationInfo.packageName, 0)
Log.d(tag, "Version name: ${packageInfo.versionName}")
Log.d(tag, "Version code: ${packageInfo.versionCode}")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment