Closed saamerm closed 4 years ago
Hi, the package currently uses core-1.7.2.aar as the Binding Lib. "In App Reviews" needs Version 1.8, at least thats what your linked docs say. It might work if the aar file is updated, maybe with some changes in the Transforms. You already know from https://github.com/xamarin/GooglePlayServicesComponents/issues/221 that the PlayCore API has some incompatible APIs but I would expect that the Review Flow should work as it seems that it only displays a new View which lets you rate the app.
@PatGet created a PR #4 Once merged, I will update the example to share the In-App review code.
Please let me know what needs to be done to update the Nuget package. Once that's done I can also share that with the others too! Hopefully we can get a lot more traction on this library :)
Nice! I have a local branch where I updated to 1.8 but did not manage to get the rating to work within the 5 minutes I had. Wanted to do that in my current vacation but had not opened the laptop once... I can merge that and if you update the sample or add a new one to do the rating I can check both features are working and provide a new nuget. Creating/updating the nuget is currently manual process, I hoped to fix that too during my vacation...
BTW.: From where did you get the aar file? Would like to ensure that it comes from a trusted source.
@PatGet Sounds like a plan. I got it from piratebay.com, nah jk, I got it from here: https://developer.android.com/guide/playcore#native. I just renamed it to add the version number as a suffix
Ok, I grabbed it directly from a maven repository so it had the right version already. Did not think about that native zip file to be honest. Great, seems to be fine so I merge.
@PatGet #5 is up! š When do you think is a good time for me to submit a PR with documentation? And is there a particular format you want me to follow?
@saamerm I had started implementing the same but glad to know someone beat me to it! I will test it tonight and let you know how it goes! Cheers, mate
@AntvissMedia no one's getting paid here, so it doesn't make a difference. I thought no one else cared about it, so I decided to just get it done lol. You can still help out with documentation, testing, stabilization! How did you find out about this. btw?
Also, you can take a look at the new PR for implementation details, since it can be quite challenging.
Same as you probably. Saw the Google post that in-app reviews exist, saw that the xamarin team are not too interested to get this in, found Pat's plugin which takes it "almost" there and then decided to help it get over the edge.
But my time has been limited lately and couldn't focus on it. Got as far as implementing it pretty much like you did, but stopped short of writing a test/example for it.
Speak soon
Kind regards, Alex
From: Saamer Mansoor notifications@github.com Sent: Friday, September 18, 2020 5:12:46 PM To: PatGet/XamarinPlayCoreUpdater XamarinPlayCoreUpdater@noreply.github.com Cc: Antviss Media info@antvissmedia.co.uk; Mention mention@noreply.github.com Subject: Re: [PatGet/XamarinPlayCoreUpdater] PlayCore- In-App Reviews (#2)
@AntvissMediahttps://github.com/AntvissMedia no one's getting paid here. I thought no one else cared about it, so I decided to just get it done lol. How did you find out about this?
ā You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/PatGet/XamarinPlayCoreUpdater/issues/2#issuecomment-694956712, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ALUTYKNQ6OBKQUB3NQ5J46LSGOBH5ANCNFSM4QLCHWIQ.
I'm actually surprised not more people care about it to be honest. It's an awesome feature to have!
Kind regards, Alex
From: Antviss Media info@antvissmedia.co.uk Sent: Friday, September 18, 2020 5:22:05 PM To: PatGet/XamarinPlayCoreUpdater XamarinPlayCoreUpdater@noreply.github.com; PatGet/XamarinPlayCoreUpdater reply@reply.github.com Cc: Mention mention@noreply.github.com Subject: Re: [PatGet/XamarinPlayCoreUpdater] PlayCore- In-App Reviews (#2)
Same as you probably. Saw the Google post that in-app reviews exist, saw that the xamarin team are not too interested to get this in, found Pat's plugin which takes it "almost" there and then decided to help it get over the edge.
But my time has been limited lately and couldn't focus on it. Got as far as implementing it pretty much like you did, but stopped short of writing a test/example for it.
Speak soon
Kind regards, Alex
From: Saamer Mansoor notifications@github.com Sent: Friday, September 18, 2020 5:12:46 PM To: PatGet/XamarinPlayCoreUpdater XamarinPlayCoreUpdater@noreply.github.com Cc: Antviss Media info@antvissmedia.co.uk; Mention mention@noreply.github.com Subject: Re: [PatGet/XamarinPlayCoreUpdater] PlayCore- In-App Reviews (#2)
@AntvissMediahttps://github.com/AntvissMedia no one's getting paid here. I thought no one else cared about it, so I decided to just get it done lol. How did you find out about this?
ā You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/PatGet/XamarinPlayCoreUpdater/issues/2#issuecomment-694956712, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ALUTYKNQ6OBKQUB3NQ5J46LSGOBH5ANCNFSM4QLCHWIQ.
I can confirm the popup comes up just fine.
The only change I made was to replace the INSTANCE property in MainActivity with the CurrentActivity instance from James Montemagno's plugin. But that's just a preference, not a necessity:
public void ShowPrompt()
{
#if DEBUG
var manager = new FakeReviewManager(CrossCurrentActivity.Current.AppContext);
#else
var manager = ReviewManagerFactory.Create(CrossCurrentActivity.Current.AppContext);
#endif
var request = manager.RequestReviewFlow();
request.AddOnCompleteListener(new OnCompleteListener(manager));
}
}
public class OnCompleteListener : Java.Lang.Object, IOnCompleteListener
{
FakeReviewManager _fakeReviewManager;
IReviewManager _reviewManager;
bool _usesFakeManager;
void IOnCompleteListener.OnComplete(Com.Google.Android.Play.Core.Tasks.Task p0)
{
if (p0.IsSuccessful)
{
var review = p0.GetResult(Java.Lang.Class.FromType(typeof(ReviewInfo)));
if (_usesFakeManager)
{
var x = _fakeReviewManager.LaunchReviewFlow(CrossCurrentActivity.Current.Activity, (ReviewInfo)review);
x.AddOnCompleteListener(new OnCompleteListener(_fakeReviewManager));
}
else
{
var x = _reviewManager.LaunchReviewFlow(CrossCurrentActivity.Current.Activity, (ReviewInfo)review);
x.AddOnCompleteListener(new OnCompleteListener(_reviewManager));
}
}
}
having said that, there is a crash happening when you cancel or select "Not now":
JniEnvironment+InstanceMethods.CallObjectMethod (Java.Interop.JniObjectReference instance, Java.Interop.JniMethodInfo method, Java.Interop.JniArgumentValue* args)
JNIEnv.CallObjectMethod (System.IntPtr jobject, System.IntPtr jmethod, Android.Runtime.JValue* parms)
IReviewManagerInvoker.LaunchReviewFlow (Android.App.Activity p0, Com.Google.Android.Play.Core.Review.ReviewInfo p1)
IOnCompleteListener.OnComplete (Com.Google.Android.Play.Core.Tasks.Task p0)
IOnCompleteListenerInvoker.n_OnComplete_Lcom_google_android_play_core_tasks_Task_ (System.IntPtr jnienv, System.IntPtr native__this, System.IntPtr native_p0)
(wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.147(intptr,intptr,intptr)
java.lang.NullPointerException: Attempt to invoke virtual method 'android.app.PendingIntent com.google.android.play.core.review.ReviewInfo.a()' on a null object reference
com.google.android.play.core.review.c.launchReviewFlow(Unknown Source:9)
crc64f9880a60d3664245.OnCompleteListener.n_onComplete(Native Method)
crc64f9880a60d3664245.OnCompleteListener.onComplete OnCompleteListener.java:44
com.google.android.play.core.tasks.a.run(Unknown Source:23)
android.os.Handler.handleCallback Handler.java:873
android.os.Handler.dispatchMessage Handler.java:99
android.os.Looper.loop Looper.java:193
android.app.ActivityThread.main ActivityThread.java:6669
java.lang.reflect.Method.invoke(Native Method)
com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run RuntimeInit.java:493
com.android.internal.os.ZygoteInit.main ZygoteInit.java:858```
also, although the popup comes up, the Submit button stays greyed out. Are you seeing the same in your test app?
Only occurred via internal app sharing. Not greyed out when released on internal test track
Yes I would also recommend Jamesās connect instead, but I didnāt want to make it dependency, so I left it out.
Hmm thatās a great catch. Iām not sure why itās crashing. How were you able to get the logs? Just āadb logcatā or were you able to do it from visual studio.
I've got the app hooked up to App Center for cases like this to make sure nothing gets missed.
Are you seeing the same thing then with your implementation without CurrentActivity (I was thinking that might cause it)?
I "fixed" the issue the classic way, with a try-catch around the OnCompleteListener
public class OnCompleteListener : Java.Lang.Object, IOnCompleteListener
{
IReviewManager _reviewManager;
private ReviewInfo review;
void IOnCompleteListener.OnComplete(Task tsk)
{
try
{
if (tsk.IsSuccessful)
{
review = (ReviewInfo)tsk.GetResult(Java.Lang.Class.FromType(typeof(ReviewInfo)));
var x = _reviewManager.LaunchReviewFlow(CrossCurrentActivity.Current.Activity, review);
x.AddOnCompleteListener(new OnCompleteListener(_reviewManager));
}
}
catch (Exception ex)
{
//Handle Exception
}
}
public OnCompleteListener(IReviewManager reviewManager)
{
_reviewManager = reviewManager;
}
}
Google themselves say that:
Important: If an error occurs during the in-app review flow, do not inform the user or change your app's normal user flow. Continue your app's normal user flow after onComplete is called.
I have tested the "Not Now" part of it and also the normal workflow by leaving a review and that went through.
Yes I just retested it, and you are right. I re-tested and was able to replicate the bug. So, I made changes and retested, and the crash went away! Thank you!!
@PatGet Any ETA on the nuget package update? The changes for the sample aren't needed for the library isn't it?
@saamerm I just submitted https://www.nuget.org/packages/PlayCore/1.8.0-rc for testing purposes. I decided to go for the same Version Number as the AAR File its based on.
@PatGet Yes. I think thatās the way to go
Once we get the example PR merged, I can update the README documentation too
@saamerm, @AntvissMedia and @PatGet That is a good progress. Testing the sample now.
@PatGet tested the 1.8.0-rc nuget, it looks good and it works š
I received an update in the morning with an app containing the rc nuget. That worked well and I pushed another update directly to test the immediate update. Hope that will be faster... As soon as I can verify it still works I push a new stsble nuget
@PatGet the nuget 1.8.0 rc works well on my side including the play core immediate update. No issues so far.
Doesn't work for me tested on multiple devices (Release Mode) nothing happens, am I missing something?
@ValonK the nuget is just the Play Core bindings. You need to implement the workflow in your Shared and Android projects. Have a look at the test project for an ideea on how to implement it.
It also needs to be on a test track not sideloaded. You can use the internal app sharing feature but it will not let you submit the review so you can't test that part.
Nuget worked well. Try to create the new stabile Version tomorrow.
Stable Version listed on NuGet. Closing the issue.
I "fixed" the issue the classic way, with a try-catch around the OnCompleteListener
Important: If an error occurs during the in-app review flow, do not inform the user or change your app's normal user flow. Continue your app's normal user flow after onComplete is called.
I have tested the "Not Now" part of it and also the normal workflow by leaving a review and that went through.
The first answer help me fix this bug: https://stackoverflow.com/questions/63552588/android-in-app-review-pop-up-crashes-the-app.
Hi! Does this package support the Android "In App Reviews" feature mentioned here?
This is the Java code showing how to integrate it into your apps.
If not supported currently, what exactly would I have to do in order to port the "In App Review" feature for Android?
Came here from this StackOverflow question that has been removed now.