in_googleplay_update 0.0.9 copy "in_googleplay_update: ^0.0.9" to clipboard
in_googleplay_update: ^0.0.9 copied to clipboard

PlatformAndroid

Plugin in app update for android from new version of google play apps update

Presented by

https://lapakprogrammer.com/

Maintained by ACHMAD MAULANA

in_googleplay_update #

Enables In App Updates on Android using the official Android APIs.

https://developer.android.com/guide/app-bundle/in-app-updates

Documentation #

The following methods are exposed:

  • Future<AppUpdateInfo> checkForUpdate(): Checks if there's an update available
  • Future<void> performImmediateUpdate(): Performs an immediate update (full-screen)
  • Future<void> startFlexibleUpdate(): Starts a flexible update (background download)
  • Future<void> completeFlexibleUpdate(): Actually installs an available flexible update
  • Stream<String> flexibleUpdateStream(): To listener flexible update state this return json string bytes_downloaded: string, total_bytes_to_download used this for make progress har download example: flexible progressbar
StreamBuilder<String>(
  stream: InAppPlayUpdate.flexibleUpdateStream(),
  builder: (context, snapshot) {
    if (snapshot.hasData) {
      String byteStringDownload = snapshot.data ?? '{}';
      final byteDownload = json.decode(byteStringDownload);
      return Column(
        children: [
          if(int.parse(byteDownload['bytes_downloaded']) == 0 && int.parse(byteDownload['total_bytes_to_download']) == 0)...[
            ElevatedButton(
              onPressed: () {
                InAppPlayUpdate.completeFlexibleUpdate().then((_) {
                  showSnack("Success!");
                }).catchError((e) {
                  showSnack(e.toString());
                });
              },
              child: const Text('Complete flexible update'),
            ),
          ] else...[
            LinearProgressIndicator(
              value: (int.parse(byteDownload['bytes_downloaded']) / int.parse(byteDownload['total_bytes_to_download'])),
            ),
            Text('${filesize(int.parse(byteDownload['bytes_downloaded']))}/${filesize(int.parse(byteDownload['total_bytes_to_download']))}',
              style: const TextStyle(
                  fontSize: 14
              ),
            )
          ]
        ],
      );
    } else {
      return Column(
        children: [
          SizedBox(height: 10),
          SizedBox(
            width: 30,
            height: 30,
            child: CircularProgressIndicator(),
          ),
          Text('This loading for download flexible indicator',
            style: const TextStyle(
                fontSize: 14
            ),
          )
        ],
      );
    }
  },
)

Please have a look in the example app on how to use it!

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

Troubleshooting #

Getting ERROR_API_NOT_AVAILABLE error #

Be aware that this plugin cannot be tested locally. It must be installed via Google Play to work. Please check the official documentation about In App Updates from Google.

0
likes
150
points
43
downloads

Publisher

verified publishertikngroup.com

Weekly Downloads

Plugin in app update for android from new version of google play apps update

Repository (GitHub)

Documentation

API reference

License

MIT (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on in_googleplay_update