joshdholtz / Sentry-Android

[Deprecated] Use official "raven-java" library
https://github.com/getsentry/sentry-java
MIT License
180 stars 48 forks source link

Android VersionName or VersionCode? #104

Closed FelixBondarenko closed 7 years ago

FelixBondarenko commented 7 years ago

Android apps have a versionName string as in "1.2.3", which should be included in an event json sent to sentry.

At the moment, in

Sentry.captureEvent(SentryEventBuilder builder)

only

builder.setRelease(Integer.toString(sentry.appInfo.versionCode));

is called, but probably something like

builder.setRelease(sentry.appInfo.versionName);

were more helpful.

The sentry webinterface shows the property 'release' as filterable property, while in an event's details, versionName is also shown. Filtering by versionName would be more helpful, imho.

Thanks for your work!!!

marcomorain commented 7 years ago

Hi Felix,

We have to choose one or the other (name or code) to use by default. I chose to use the versioncode initially because I wasn't sure if the versionname had to be unique or not between releases.

I'm happy to change it if you'd like to submit a PR?

Ultimately though, we can't keep everyone happy with default settings. The idea is that anyone can add an event capture listener to change any event settings to override the defaults.

FelixBondarenko commented 7 years ago

Hi Marc,

you're certainly right, default implementation are there to be customized.

But as the property in question is called 'release' and the android's versionName contains a release version name which should be updated on every release and contains more information (major, minor, patch semantics) than a single integer, versionName is much more recognizable than versionCode for most people.

I'll have a look into it a little bit closer before i decide wether PR or event capture listener will be my way to go.

FelixBondarenko commented 7 years ago

Hi Marc,

Android's documentation says in Version Your App:

versionCode — An integer used as an internal version number. This number is used only to 
              determine whether one version is more recent than another, with higher numbers
              indicating more recent versions. This is not the version number shown to users;
              that number is set by versionName setting[...]

So i think this should be the default value to use.

I will create a PR.