fluttercommunity / plus_plugins

Flutter Community Plus Plugins
BSD 3-Clause "New" or "Revised" License
1.62k stars 977 forks source link

Add store names to "installerStore" documentation #1468

Open Francesco-FL opened 1 year ago

Francesco-FL commented 1 year ago

Plugin

package_info_plus

Use case

My goal is to open my apps page based on the store where the app was downloaded.

So if the user has downloaded the app on Google Play, I would like to open the Google Play developer page, same thing for iOS, Amazon, and other stores.

To do this, I need to know from which store the app was installed.

You added installerStore, but in my opinion it's not documented enough, because I don't know what names to compare the string with. I don't know if installerStore will return me for example "com.android.vending" or "Google Play Store" or something else.

The package I've used up to now (and which internally allowed you to understand exactly which store you were in) was this: https://pub.dev/packages/store_checker

Proposal

I see two possibilities to improve the function:

or

ueman commented 1 year ago

There can be an potentially infinite number of installer stores, so maintaining a mapping seems unreasonable.

robertnicjoo commented 3 weeks ago

There can be an potentially infinite number of installer stores, so maintaining a mapping seems unreasonable.

Hi @ueman , We understand that there might be many installer stores but at least provide the official ones such as google play store, app store (and their review team installer names).

I've had an app that was rejected cause google reviewer could not pass this validation

Future isInstalledFromPlayStore() async {
 PackageInfo packageInfo = await PackageInfo.fromPlatform();
 return packageInfo.installerStore ?? "unknown";
}

Then in initState I called it:

String installerSource = await isInstalledFromPlayStore();
// com.android.shell is when app is in development and running it on emulator
if (installerSource == 'play_store' || installerSource == 'com.android.shell') {
  debugPrint('App is installed from Google Play Store.');
} else {
  debugPrint('App is NOT installed from Google Play Store.');
}

Apparently when google reviewer downloads the app to validate it, none of these will be happening play_store com.android.shell