Version Enforcement
Set a minimum required app version per environment. Force users to update immediately or prompt them softly — without shipping a new build.
Why version enforcement matters
Mobile apps have long tails of old versions. After a breaking API change, a security fix, or a critical bug fix, you need a way to ensure users upgrade without waiting for organic App Store update adoption.
Koolbase lets you set a minimum version from the dashboard. Users below that version see either a mandatory update screen (force update) or a dismissible prompt (soft update) — no code change or new release required.
Update modes
force_updateForce UpdateThe app is blocked. The user must update before they can continue. Use for breaking API changes or critical security patches.
soft_updateSoft UpdateA dismissible prompt is shown. The user can continue using the app but is encouraged to update. Use for non-critical improvements.
up_to_dateUp to DateThe user's version meets or exceeds the minimum. No update UI is shown.
Check version on startup
Call Koolbase.checkVersion() after initializing, before showing your app. In Flutter the SDK reads the installed version itself (through package_info_plus); in React Native and on the web, pass your app's version.
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await Koolbase.initialize(const KoolbaseConfig(
publicKey: 'pk_live_...',
baseUrl: 'https://api.koolbase.com',
));
// Compares the installed version with the environment's policy
final check = Koolbase.checkVersion();
switch (check.status) {
case VersionStatus.forceUpdate:
// check.storeUrl: the store page set in the dashboard for this platform
runApp(ForceUpdateApp(message: check.message, storeUrl: check.storeUrl));
case VersionStatus.softUpdate:
// Show the app with a dismissible update banner
runApp(MyApp(showUpdateBanner: true, updateMessage: check.message));
case VersionStatus.upToDate:
runApp(const MyApp());
}
}Force update screen example
class ForceUpdateApp extends StatelessWidget {
final String message;
final String? storeUrl;
const ForceUpdateApp({required this.message, this.storeUrl, super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: Center(
child: Padding(
padding: const EdgeInsets.all(32),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Icon(Icons.system_update, size: 64, color: Colors.blue),
const SizedBox(height: 24),
Text(message, textAlign: TextAlign.center),
const SizedBox(height: 32),
if (storeUrl != null)
ElevatedButton(
onPressed: () => launchUrl(Uri.parse(storeUrl!)),
child: const Text('Update Now'),
),
],
),
),
),
),
);
}
}Setting the version policy
Open Configuration → Version Policy. Each environment has a policy per platform: Android, iOS, and All platforms. An iOS or Android app uses its own platform's policy, or All platforms when its own is not set. Web apps are never asked to update: a browser always loads the latest site.
Version comparison uses semver
2.1.0 > 2.0.9 > 1.99.0. Make sure your app version in pubspec.yaml follows semver format (major.minor.patch).