androidiosflutterapkupdating

How to automatically update a Flutter Mobile app to newer version when the application is not on play store or app store?


let's say i have a Flutter APK hosted on my website where users can download and install , what i'm interested to know is how possible that the application can check for newer version when the app lunches and if true a progress bar appears showing the automatic updating of the application from the server (not play store or app store) ? .
here is a company that do exactly the mentioned above meaning :

any ideas how to achieve this ?


Solution

  • i found this package ota_update 2.4.1,looks very promising for updating a Flutter from a remote hosted Apk here is an exmple :

       // IMPORT PACKAGE
        import 'package:ota_update/ota_update.dart';
        
          // RUN OTA UPDATE 
          // START LISTENING FOR DOWNLOAD PROGRESS REPORTING EVENTS
          try {
              //LINK CONTAINS APK OF FLUTTER HELLO WORLD FROM FLUTTER SDK EXAMPLES
              OtaUpdate()
                  .execute(
                'https://internal1.4q.sk/flutter_hello_world.apk',
                // OPTIONAL
                destinationFilename: 'flutter_hello_world.apk',
                //OPTIONAL, ANDROID ONLY - ABILITY TO VALIDATE CHECKSUM OF FILE:
                sha256checksum: "d6da28451a1e15cf7a75f2c3f151befad3b80ad0bb232ab15c20897e54f21478",
              ).listen(
                (OtaEvent event) {
                  setState(() => currentEvent = event);
                },
              );
          } catch (e) {
              print('Failed to make OTA update. Details: $e');
          }
    

    any other proposed solutions are welcome.