Is it possible to detect that an android app is either a beta version or production version?

后端 未结 6 867
半阙折子戏
半阙折子戏 2020-12-29 03:29

We use beta staging in google play store. For app side force update functionality we want to detect if our app is either coming from the beta stage or the production stage o

6条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-29 03:55

    With "beta" or "staging" in your app version name, you can get it with getPackageInfo() and check with a Regex or indexOf

    context.packageManager.getPackageInfo(context.packageName, 0).versionName.indexOf("beta") >= 0
    

提交回复
热议问题