timtraversy / new_version

Check if your user has the most recent version of your Flutter app.
BSD 3-Clause "New" or "Revised" License
125 stars 152 forks source link

When my local app version and PlayStore version are the same after that show this pop-up. #62

Closed HappySinha closed 3 years ago

HappySinha commented 3 years ago

I don't know why I'm facing this issue. When my local app version and PlayStore version are the same after that show this pop-up.

I'm using very simple code and default code

  @override
   void initState() {
      super.initState();
      ...
      checkVersion();
    }

  void checkVersion() async {
    final newVersion = NewVersion(
      androidId: "banda.app",
    );

  final status = await newVersion.getVersionStatus();
  newVersion.showUpdateDialog(
    versionStatus: status,
    context: context,
  );
}

This is a Screenshot:- https://user-images.githubusercontent.com/53011602/133896317-4ba20fa4-0e10-4c05-b02f-193073fe070b.jpg

This code work on our project.

  @override
   void initState() {
      super.initState();
      ...
      checkVersion();
    }
void checkVersion() async {
  final newVersion = NewVersion(
    androidId: "banda.app",
  );

  final status = await newVersion.getVersionStatus();

// I'm checking manual add If condition
 if (status.localVersion != status.storeVersion) {
    newVersion.showUpdateDialog(
      versionStatus: status,
      context: context,
    );
  }
}
timtraversy commented 3 years ago

Hello - do you still need assistance here?

HappySinha commented 3 years ago

Hello - do you still need assistance here?

Yes I need assistance. Can you provide me please

timtraversy commented 3 years ago

Ah ok - you closed this issue so I thought it might be resolved.

What values are localVersion and storeVersion being set as?

HappySinha commented 3 years ago

Yes I'm solved this is issue in my code. But you very need to resolve this issue. I request you. Please please please 🙏

timtraversy commented 3 years ago

Oh I see the issue - calling newVersion.showUpdateDialog will show an update dialog no matter what. So you have to either:

  1. Call newVersion.showAlertIfNecessary() which will fetch the store version and display the alert if it is higher than local.
  2. Compare the local and store versions manually, as you are doing in your second code block.
HappySinha commented 3 years ago

Oh I see the issue - calling newVersion.showUpdateDialog will show an update dialog no matter what. So you have to either:

  1. Call newVersion.showAlertIfNecessary() which will fetch the store version and display the alert if it is higher than local.
  2. Compare the local and store versions manually, as you are doing in your second code block.

Oh yes | Thank-you so much for helping me