I want the users of my app to always have the latest version. If they don't have the latest version, it should download the latest version from play store first as shown in the image.
I found a package called Upgrader but this just gives a prompt. It is not linked to play store as shown in image.
Edit
As suggested by Maadhav Sharma, now I am using the in_app_update package but it says no update available.
This is my code:
....
class _TnPState extends State<TnP> {
ThemeBloc _themeBloc;
FirebaseMessaging _firebaseMessaging;
NotificationBloc _notificationBloc;
String _test;
@override
void initState() {
_themeBloc = ThemeBloc();
_firebaseMessaging = FirebaseMessaging();
_notificationBloc = NotificationBloc();
_firebaseMessaging.configure(
onMessage: (notification) async => _notificationBloc.yes(),
onResume: (notification) async => _notificationBloc.yes(),
onLaunch: (notification) async => _notificationBloc.yes(),
);
checkForUpdate();
super.initState();
}
Future<void> checkForUpdate() async {
InAppUpdate.checkForUpdate().then((info) {
String display = info.toString();
setState((){
_test = display;
});
});
}
@override
Widget build(BuildContext context) {
return StreamBuilder<AppTheme>(
stream: _themeBloc.themeStream,
initialData: AppTheme.Light,
builder: (context, AsyncSnapshot<AppTheme> snapshot) {
return MaterialApp(
title: 'TnP',
debugShowCheckedModeBanner: false,
theme: appThemeData[snapshot.data],
home: _test==null ?
Container() :
InAppUpdateScreen(display: _test),//SplashScreen(),
);
},
);
}
}
InAppUpdateScreen
just displays the text.
App in play store shows update is available:
But the app which is an older version installed via playstore shows no update:
Any idea how to solve this?
flutter_updater. This library allows you to easily add auto-update functionality to your Android, iOS, and Windows Flutter application. Our use case was to update the app by launching the App Store on iOS or install/execute the Android APK or Windows executable; thus, this package was born.
An Android App Bundle is a file (with the . aab file extension) that you upload to Google Play to support Dynamic Delivery. So to make new changes that you made to your app's functionality - you should upload the aab file. You can find app bundle files located in build/app/outputs within your app's folder.
How to update app version in Flutter. To update the app version in Flutter, you can simply open the pubspec. yaml file and then update the version tag. Inside the version tag, just increase the build number (for Android) or CFBundleVersion (for iOS).
For forcing the app user to update if an update is available in the market, you should first check the app version on the market and compare it with the version of the app on the device. If they are different, it may be an update available.
I have an app in Google Play Store. When an update version is available, the older version will become unusable – that is, if users do not update the app, they do not enter in the app. How can I force users to update the app when a new version becomes available?
The library provides you 2 different ways to notify the users about the update: Flexible, when users can continue using the app while it is being updated in the background. Immediate - blocking screen that doesn't allow a user to enter the app until they update it. There are next steps to implement it:
3- when you submit a new release with a different version code number, then PlayStore will make your app updatable. so always make sure to change your versionCode first and then create a new release after that
There is a package for what you want:
https://pub.dev/packages/in_app_update
Android
This plugin integrates the official Android APIs to perform in app updated that were released in 2019: https://developer.android.com/guide/app-bundle/in-app-updates
iOS
iOS does not offer such a functionality. You might want to look into e.g. https://pub.dev/packages/upgrader. If you call the methods above on a iOS device you'll run into a not-implemented exception.
Thanks...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With