sp-react-native-in-app-updates icon indicating copy to clipboard operation
sp-react-native-in-app-updates copied to clipboard

result.storeVersion shows version code instead of app versions

Open rahulg1254 opened this issue 1 year ago • 5 comments

Greetings! At our company, we are currently working on an application that utilizes the in-app update functionality. However, we have encountered an issue where the result.storeversion is returning the version code (e.g. 7) instead of the app version (e.g. 1.0.6) which we were expecting. Is there a solution or method to retrieve the app version instead? We appreciate any suggestions you may have.

rahulg1254 avatar Mar 15 '23 09:03 rahulg1254

@rahulg1254 Hi! I'm not an expert but this library (as you probably already know) uses the native system capabilities so for android AppUpdateManager doesn't return app version it returns version code only. Unfortunately.

https://developer.android.com/reference/com/google/android/play/core/appupdate/AppUpdateInfo.html#availableVersionCode()

Now I'm in the same situation and I choose between a working with a code version or a using our server to keep a app version. Both of these options have their pros and cons. The second one is the immediate lack of automation, but the first one it isn't a work with semantic version. And so on ...

I think you have already thought about these options yourself. So you can share your experience in this if you wont 😄.

Lepidopterolog avatar Mar 28 '23 19:03 Lepidopterolog

@SudoPlz Loving this library so far as this is one of its kind ! Was just wondering.. is there any way I could get the update priority which the play core service returns ? Only then can I decide if an update is immediate or flexible.

Here's the reference to the updatePriority() docs : https://developer.android.com/reference/com/google/android/play/core/appupdate/AppUpdateInfo.html#updatePriority()

mritul avatar Apr 28 '24 15:04 mritul

hey @mritul, thanks for your kind words. We do expose that here https://github.com/SudoPlz/sp-react-native-in-app-updates/blob/36f2e9b0da69c88a945010d43f3d1035a6e62810/android/src/main/java/com/sudoplz/rninappupdates/SpReactNativeInAppUpdatesModule.java#L106 which is exposed in a field called other in the checkNeedsUpdate response.

So essentially you should be able to do:

const response = await checkNeedsUpdate(...)
response.other. updatePriority

should work.

SudoPlz avatar Apr 29 '24 15:04 SudoPlz

Right ! Thanks for the prompt response ✌️

mritul avatar Apr 29 '24 15:04 mritul

@SudoPlz Also is there any way I could achieve the full screen update. Because currently startUpdate redirects to the play store.

Screenshot_2024-05-01-12-53-08-18_40deb401b9ffe8e1df2f1cc5ba480b12.jpg

mritul avatar May 01 '24 07:05 mritul