mikehardy / react-native-update-apk

Update apk from non-play store servers, and update ios from app store in React Native.
MIT License
195 stars 57 forks source link

Implement ability to compare minSdkVersion and download appropriate APK #10

Open mikehardy opened 5 years ago

mikehardy commented 5 years ago

The system should be able to detect the current device API, the version JSON on the server may contain minSDK information for specific APKs, and the downloader should not fetch an APK with a minSdkVersion that is greater than the device API

This can help the system handle version skew over time

mikehardy commented 5 years ago

Following implementation of #6 add elements for "minSdk" #sdk (and "abi"), so that we may do device-specific (and thus smaller) downloads

mikehardy commented 5 years ago

Quick note to mention that the downloads should then be one URL for a universal download, but contain an array of more specific options, with a key that was perhaps a pipe-delimited selector that was like 'abi|minSdk|...' and could contain for any field 'all', or a specific value, and the library could handle fallbacks.

So you could publish a universal APK plus an api16|arm APK, and for an arm64 + api 18 device that react-native-device info indicated could fall back to arm, the api16|arm would be a possible match with preference over the universal download, and thus selected. But if there was an api18|arm, or an api16|arm64 apk those would take precedence.

If you publish api18|all then it signifies the APK should match all ABIs that don't have a specific build

Thinking about which selector wins, I would fix API as more important than ABI, as API unlocks extra functionality, whereas ABI is just size and performance. I suppose in a future enhancement you could specify your preference order.