How to get Mobile App APK/IPA Version?

I have requirement to show in mobile app:

1. App/Play Store Version

2. Tagged lifetime version

It's for troubleshooting purpose, because especially on IOS, there's no automatic update.

If I can get APK/IPA version, then I can notify user to update before continuing using app. 

When generating APK/IPA, it retrieved binary version from lifetime tagged version, but any subsequent deployment without changes to binary APK/IPA will increment lifetime tagged version, so it will be different. 

Thanks. 

I got it for no 1, apk/ipa version number:

https://www.outsystems.com/forge/component-overview/2913/app-version-plugin


Now, how can I get tagged lifetime version?