Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sending versionCode as game_version is inconsistent with iOS SDK #1651

Closed
jalada opened this issue Sep 22, 2022 · 4 comments
Closed

Sending versionCode as game_version is inconsistent with iOS SDK #1651

jalada opened this issue Sep 22, 2022 · 4 comments

Comments

@jalada
Copy link

jalada commented Sep 22, 2022

In this SDK you send the package's versionCode as game_version (which shows up in the OneSignal interface as App Version). But on iOS you send the Version which (I think?) is more analgous to versionName - it doesn't affect builds like versionCode does on Android (that'd be a bit more like Build on iOS I guess).

Android:

deviceInfo.put("game_version", packageManager.getPackageInfo(packageName, 0).versionCode);

iOS:

https://github.com/OneSignal/OneSignal-iOS-SDK/blob/f55808d7907fd3da97eda0c0b8674806763fdcd1/iOS_SDK/OneSignalSDK/Source/OneSignal.m#L1697

For multi-platform apps, especially React Native, this causes some frustrating inconsistency in the OneSignal UI and means we have to resort to our own custom app version trigger. These apps have the same version string, think you can guess which ones are Android and which are iOS:

image

I can't see a way to customise this behaviour on either iOS or Android referenced in the documentation nor obvious in the code. Is there something that could be added to help line these up?

@jennantilla
Copy link
Contributor

jennantilla commented Oct 7, 2022

Hi @jalada, App Version pulls from Android's versionCode in your app's build.gradle file whereas iOS uses CFBundleShortVersionString. You can update XCode's Bundle version string (short) to align app versions:
Screen Shot 2022-10-07 at 2 47 35 PM
Screen Shot 2022-10-07 at 2 49 34 PM
Let us know if that works for you!

@jalada
Copy link
Author

jalada commented Oct 10, 2022

Hi @jennantilla. I don't think that really makes sense, but perhaps I'm being a noob? Here's the description of CFBundleShortVersionString from Apple:

This key is a user-visible string for the version of the bundle. The required format is three period-separated integers, such as 10.14.1. The string can only contain numeric characters (0-9) and periods.

And here's the description of versionCode from Google:

A positive 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 the versionName setting.

It seems to me like you are using two different version numbers from the two platforms to mean the same thing in OneSignal.

I'd argue that on Android you should be using versionName if you're going to use CFBundleShortVersionString from iOS. Here's Google's description of versionName:

versionName — A string used as the version number shown to users. This setting can be specified as a raw string or as a reference to a string resource. The value is a string so that you can describe the app version as a .. string, or as any other type of absolute or relative version identifier. The versionName has no purpose other than to be displayed to users.

That sounds much closer to Apple's description of CFBundleShortVersionString; both are user visible, both can be in semantic versioning format

@jennantilla
Copy link
Contributor

Hi @jalada thanks for sharing this feedback! We do not currently have a setting to switch version numbers between Android/iOS. Updating this would be a breaking change, so would be something to be considered as part of a future major release.

A workaround would be to set the version numbers you need as a data tag, or to send separate notifications for each type of version code.

@jennantilla
Copy link
Contributor

Closing issue due to no response. Please @ mention me if we need to revisit this issue.

We have an updated major release available for our Android SDK with many improvements and enhancements! Please refer to the migration guide for more information on upgrading.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants