in_app_review icon indicating copy to clipboard operation
in_app_review copied to clipboard

`requestReview` does nothing on Android

Open lukehutch opened this issue 1 year ago • 17 comments

requestReview does nothing on Android. Here are the logs:

I/InAppReviewPlugin(22895): cacheReviewInfo: Requesting review flow
I/PlayCore(22895): UID: [10195]  PID: [22895] ReviewService : Initiate binding to the service.
I/PlayCore(22895): UID: [10195]  PID: [22895] ReviewService : ServiceConnectionImpl.onServiceConnected(ComponentInfo{com.android.vending/com.google.android.finsky.inappreviewservice.InAppReviewService})
I/PlayCore(22895): UID: [10195]  PID: [22895] ReviewService : linkToDeath
I/PlayCore(22895): UID: [10195]  PID: [22895] ReviewService : Unbind from service.
I/PlayCore(22895): UID: [10195]  PID: [22895] OnRequestInstallCallback : onGetLaunchReviewFlowInfo
I/InAppReviewPlugin(22895): onComplete: Successfully requested review flow
I/InAppReviewPlugin(22895): onMethodCall: requestReview
I/InAppReviewPlugin(22895): requestReview: called
I/InAppReviewPlugin(22895): noContextOrActivity: called
I/InAppReviewPlugin(22895): launchReviewFlow: called
I/InAppReviewPlugin(22895): noContextOrActivity: called

After these logs are printed to the console, requestReview returns from the await without throwing an exception.

Flutter 3.23.0-0.1.pre • channel beta • https://github.com/flutter/flutter.git Framework • revision 2feea7a407 (6 weeks ago) • 2024-06-06 10:19:10 +0700 Engine • revision bb10c54666 Tools • Dart 3.5.0 (build 3.5.0-180.3.beta) • DevTools 2.36.0 Android API 33

lukehutch avatar Jul 17 '24 07:07 lukehutch

I have a similar Issue. It opened once, and i think this is Intended by the operating System. But it would be nice to get an Error/ Return Object to react to "requestReview" results. Or at least the isAvailable function shouldn't return true if the popup is already called and not available anymore.

It's a bad UX when nothing happens on my Button press.

Any suggestions ?

HenrikH96 avatar Jul 23 '24 09:07 HenrikH96

requestReview does nothing on Android. Here are the logs:

I/InAppReviewPlugin(22895): cacheReviewInfo: Requesting review flow
I/PlayCore(22895): UID: [10195]  PID: [22895] ReviewService : Initiate binding to the service.
I/PlayCore(22895): UID: [10195]  PID: [22895] ReviewService : ServiceConnectionImpl.onServiceConnected(ComponentInfo{com.android.vending/com.google.android.finsky.inappreviewservice.InAppReviewService})
I/PlayCore(22895): UID: [10195]  PID: [22895] ReviewService : linkToDeath
I/PlayCore(22895): UID: [10195]  PID: [22895] ReviewService : Unbind from service.
I/PlayCore(22895): UID: [10195]  PID: [22895] OnRequestInstallCallback : onGetLaunchReviewFlowInfo
I/InAppReviewPlugin(22895): onComplete: Successfully requested review flow
I/InAppReviewPlugin(22895): onMethodCall: requestReview
I/InAppReviewPlugin(22895): requestReview: called
I/InAppReviewPlugin(22895): noContextOrActivity: called
I/InAppReviewPlugin(22895): launchReviewFlow: called
I/InAppReviewPlugin(22895): noContextOrActivity: called

After these logs are printed to the console, requestReview returns from the await without throwing an exception.

Flutter 3.23.0-0.1.pre • channel beta • https://github.com/flutter/flutter.git Framework • revision 2feea7a407 (6 weeks ago) • 2024-06-06 10:19:10 +0700 Engine • revision bb10c54666 Tools • Dart 3.5.0 (build 3.5.0-180.3.beta) • DevTools 2.36.0 Android API 33

Hey, did you see the testing guidelines? https://pub.dev/packages/in_app_review#testing-read-carefully

britannio avatar Jul 24 '24 20:07 britannio

Hey, did you see the testing guidelines? https://pub.dev/packages/in_app_review#testing-read-carefully

The docs appear to be incomplete. They basically imply that the submit button will be disabled if you don't have an app bundle uploaded to at least the "internal app sharing" track. However, that's not the behavior I am reporting: the dialog doesn't even pop up, and no error message is even reported to the console.

Yes, this might be caused by not having an app in production yet (I have several builds uploaded for testing). However, whatever the cause, in_app_review should report an error to the console at a bare minimum, and ideally also show an error message in a dialog, rather than failing silently.

lukehutch avatar Jul 24 '24 21:07 lukehutch

  @override
  Future<void> requestReview() async {
    if (kDebugMode && _platform.isAndroid) {
      print( 'in_app_review must be tested with a build downloaded from the Play Store.');
    }
    return _channel.invokeMethod('requestReview');
  }

Would this suffice? Showing a dialog is fine until I get an issue saying "why is this dialog being shown in production".

britannio avatar Jul 25 '24 20:07 britannio

Actually, based on https://stackoverflow.com/questions/37539949/detect-if-an-app-is-installed-from-play-store it is possible to detect if the app was installed via the Play Store or via any store.

britannio avatar Jul 25 '24 20:07 britannio

A console message is much better than nothing. Nothing should ever fail silently.

lukehutch avatar Jul 25 '24 20:07 lukehutch

@lukehutch Do you get a log that looks like isAvailable: playStoreAndPlayServicesAvailable: <true/false> before the logs you posted?

britannio avatar Jul 25 '24 20:07 britannio

I didn't notice that in the logs, but on this device Play Services should be available.

(If you need me to test this, it will be a couple of days before I will be able to get to it.)

lukehutch avatar Jul 25 '24 20:07 lukehutch

Any updates on this? I got the same issue.

image

rsillador avatar Aug 20 '24 08:08 rsillador

In case it helps anyone else, this is what I resorted to doing:

  final startTime = Stopwatch()..start();
  if (await inAppReview.isAvailable()) {
    try {
      await inAppReview.requestReview();
    } catch (e, st) {
      logError(
        message: 'Failed to request app review',
        error: e,
        stacktrace: st,
      );
    }
  }
  final elapsedMilliseconds = startTime.elapsedMilliseconds;
  if (elapsedMilliseconds > 300) {
    // If the above method did not return immediately, assume it
    // succeeded in opening the rating modal, and return
    return;
  }

  // Otherwise if the above method failed, try opening the store listing by URL
  try {
    // Use `url_launcher` rather than `openStoreListing`
    await launchUrl(Uri.parse(Platform.isAndroid
        ? 'https://play.google.com/store/apps/details?id=$androidPackageName'
        : 'https://apps.apple.com/us/app/click-social/id$appStoreId'));
  } catch (e, st) {
    logError(
      message: 'Failed to open app store listing',
      error: e,
      stacktrace: st,
    );
  }

I use launchUrl rather than openStoreListing because I had a report by one user that if openStoreListing is called, they get a version of the Play Store listing that does not allow them to rate the app:

https://github.com/britannio/in_app_review/issues/131

lukehutch avatar Aug 26 '24 21:08 lukehutch

final elapsedMilliseconds = startTime.elapsedMilliseconds; if (elapsedMilliseconds > 300) { // If the above method did not return immediately, assume it // succeeded in opening the rating modal, and return return; }

I just tried your code on iOS simulator, and on iOS physical, and it returns immediately with 0 elapsed time. Does await even do anything on requestReview() ?

Edit: okay sometimes it's like 12 - 16 milliseconds, nowhere near the 300 mark

nicolaikol avatar Sep 06 '24 07:09 nicolaikol

@nicolaikol I didn't test it on iOS, but I did read the source before and it looks like the method is supposed to block until it has a result from user interaction. I could be reading the code wrong though, or possibly the code is returning as soon as the dialogue is open, before the user has tapped on anything.

I picked the 300ms based only on human reaction time, not based on the actual method return time. My assumption was that if there wasn't enough time to pop up a dialogue and have the user tap on a button, then either the dialog must not have opened, or it must have opened and immediately closed without user intervention.

There could be a flaw in the logic here, I am open to other suggestions!

lukehutch avatar Sep 06 '24 08:09 lukehutch

There could be a flaw in the logic here, I am open to other suggestions!

I've tried a few approaches, but I can't find any way to detect the OS popup on iOS. Therefore my approach is to have a conservative policy for when I ask the user and assume it will work whenever i call it...

if (await inAppReview.isAvailable()) {
    try {
      await inAppReview.requestReview();
      return;
    } catch (e, st) {
      logger.e(
        'Failed to request app review',
        error: e,
        stackTrace: st
      );
    }
  }

  // Otherwise if the above method failed, try opening the store listing by URL
  try {
    await LaunchReview.launch(
        writeReview: true, iOSAppId: iOSAppId, androidAppId: androidAppId);
  } catch (e, st) {
    logger.e(
      'Failed to open app store listing',
      error: e,
      stackTrace: st,
    );
  }

Maybe the package would actually work as expected if they use the new non-deprecated iOS api's, just a wild guess though...

nicolaikol avatar Sep 08 '24 19:09 nicolaikol

Maybe the package would actually work as expected if they use the new non-deprecated iOS api's, just a wild guess though...

@nicolaikol PRs welcome :)

britannio avatar Sep 09 '24 00:09 britannio

I have a version of app in Play Market, but await inAppReview.requestReview() doesnt show any thing in Open Testing since the first dialog h've been shown.

Shkryabminer avatar Sep 24 '24 07:09 Shkryabminer

Hi! Is this lib well tested on devices with Android 14.0? Nothing happening on invoking requestReview method. Got the same logs as @lukehutch mentioned.

AtamyratBabayev avatar Sep 26 '24 12:09 AtamyratBabayev

Same. Not working with Android 14. Any workarounds?

justerror avatar Oct 16 '24 06:10 justerror

Still facing the same error with Android 15. The app is in production and while on internal testing the popup is never shown. inAppReview.isAvailable() returns true.

ghost avatar Nov 06 '24 14:11 ghost

I can see the dialog when I upload internal sharing, but when I try to upload production, internal tests, etc., it does not work.

VB10 avatar Nov 08 '24 14:11 VB10

Is there any updates? million of people is dying because of this bug.

rhaynel2024 avatar Nov 13 '24 03:11 rhaynel2024

Is the problem fixed in the latest version 2.0.10?

justerror avatar Nov 25 '24 08:11 justerror

Is the problem fixed in the latest version 2.0.10?

It's hard to discern if there's a real issue or if people skipped the testing documentation that states the quirks of the underlying API (it generally won't work if you installed your app via flutter run or flutter run --release. https://pub.dev/packages/in_app_review#testing-read-carefully

The native Java code is simple and nobody has pointed out an issue with it.

britannio avatar Nov 25 '24 11:11 britannio

The latest release (2.0.10) fixed a crash caused by the underlying API but didn't change anything else on Android. https://developer.android.com/reference/com/google/android/play/core/release-notes-in_app_reviews

britannio avatar Nov 25 '24 11:11 britannio

It's hard to discern if there's a real issue or if people skipped the testing documentation that states the quirks of the underlying API (it generally won't work if you installed your app via flutter run or flutter run --release. https://pub.dev/packages/in_app_review#testing-read-carefully

The native Java code is simple and nobody has pointed out an issue with it.

For me, the problem appears when I install the app from the PlayStore (production channel). I can see the logs (sent via file upload, not console) that inAppReview.isAvailable() returns true and inAppReview.requestReview() is called;

This is my code

final InAppReview inAppReview = InAppReview.instance;
if (await inAppReview.isAvailable()) {
  logger.d('[FEEDBACK] InAppReview available', printToFile: true);
  try {
    return inAppReview.requestReview();
  } catch (e, stackTrace) {
    logger.e('[FEEDBACK] Error requesting review: $e', stackTrace: stackTrace);
  }
} else {
  logger.d('[FEEDBACK] InAppReview not available', printToFile: true);
}

all I see in the logs is this, meaning requestReview(); is called

[FEEDBACK] InAppReview available

ghost avatar Nov 25 '24 11:11 ghost

It's hard to discern if there's a real issue or if people skipped the testing documentation that states the quirks of the underlying API (it generally won't work if you installed your app via flutter run or flutter run --release. https://pub.dev/packages/in_app_review#testing-read-carefully The native Java code is simple and nobody has pointed out an issue with it.

For me, the problem appears when I install the app from the PlayStore (production channel). I can see the logs (sent via file upload, not console) that inAppReview.isAvailable() returns true and inAppReview.requestReview() is called;

This is my code

final InAppReview inAppReview = InAppReview.instance;
if (await inAppReview.isAvailable()) {
  logger.d('[FEEDBACK] InAppReview available', printToFile: true);
  try {
    return inAppReview.requestReview();
  } catch (e, stackTrace) {
    logger.e('[FEEDBACK] Error requesting review: $e', stackTrace: stackTrace);
  }
} else {
  logger.d('[FEEDBACK] InAppReview not available', printToFile: true);
}

all I see in the logs is this, meaning requestReview(); is called

[FEEDBACK] InAppReview available

Have you tried using internal app sharing or an internal test track? The production track is not recommended for testing.

See this troubleshooting table: https://developer.android.com/guide/playcore/in-app-review/test#troubleshooting

britannio avatar Nov 25 '24 11:11 britannio

This issue reproduced only in production channel for latest Android. Also, we can see it by the number of ratings from Android 14 - significantly less than older Android or iOS. It perfectly works in internal testing, so it's not caused by inaccurate testing.

If someone has already updated lib to the latest version (2.0.10), please let us know about possible fixing this issue.

justerror avatar Nov 25 '24 12:11 justerror

This issue reproduced only in production channel for latest Android. Also, we can see it by the number of ratings from Android 14 - significantly less than older Android or iOS. It perfectly works in internal testing, so it's not caused by inaccurate testing.

If someone has already updated lib to the latest version (2.0.10), please let us know about possible fixing this issue.

If it works in internal testing then it's out of my hands and almost certainly works as Google intended. I've been testing on Android 14 and now Android 15 with my Pixel 7 Pro.

britannio avatar Nov 25 '24 13:11 britannio

This issue reproduced only in production channel for latest Android. Also, we can see it by the number of ratings from Android 14 - significantly less than older Android or iOS. It perfectly works in internal testing, so it's not caused by inaccurate testing.

If someone has already updated lib to the latest version (2.0.10), please let us know about possible fixing this issue.

Tested in production with 2.0.10 version in my google pixel 8 pro, and nothing happens.

Edit: Same code was working properly few weeks ago on my flutter app

DanielMartini avatar Nov 25 '24 17:11 DanielMartini

If it works in internal testing then it's out of my hands and almost certainly works as Google intended. I've been testing on Android 14 and now Android 15 with my Pixel 7 Pro.

You're saying if it works in internal testing but it's broken in production, then it's "out of your hands"? Huh?

(I can't confirm if it work in internal testing, but I can confirm that it's broken in production.)

lukehutch avatar Nov 25 '24 17:11 lukehutch

If it works in internal testing then it's out of my hands and almost certainly works as Google intended. I've been testing on Android 14 and now Android 15 with my Pixel 7 Pro.

You're saying if it works in internal testing but it's broken in production, then it's "out of your hands"? Huh?

(I can't confirm if it work in internal testing, but I can confirm that it's broken in production.)

I'm saying that if it works in internal testing then I'm confident that it works in production. If there is evidence that contradicts this then I don't suspect that it would be an issue with this plugin but rather an issue to bring to the Android team directly if a compelling case can be built.

Send me a production link to your app with instructions to trigger the popup and I'll send a screenshot of it hopefully working.

To my knowledge, the plugin isn't flat-out broken on all devices so if we can find some reproducibility criteria then progress can be made.

Official docs for reference: https://developer.android.com/guide/playcore/in-app-review/test

britannio avatar Nov 25 '24 18:11 britannio