Android Question How to use AS RatingBar with Google Playstore App-Rating

GMan

Well-Known Member
Licensed User
Longtime User
How can i use the AS RatingBar Lib with Google Playstore App-Rating ?
The sample works fine, but how to submit the result to the Playstore ?
 

JohnC

Expert
Licensed User
Longtime User
My guess is that you wont be able to because if you could programmically post a rating to the playstore, what would prevent bad devs from posting 5 star ratings for their apps in the background.

I think google will probably always require a user to manually post ratings from within the playstore app.
 
Upvote 0

GMan

Well-Known Member
Licensed User
Longtime User
There where 2 solutions in the past, so i thougth this one is a new one.
If not for Playstore, for what else is that needed ?
And -however- i have to send the results to anyone/anything, otherwise its only a nice-looking "nothing".
I think AS (#Alexander Stolte) don't do those funny things (by looking on his other Libs)
 
Upvote 0

Quillok

Member
Licensed User
Longtime User
You can't submit the rating to the Playstore.
This ist something that a user has to do manually.
As JohnC already said, if there would be a way like this, every app in the store would have a perfect 5 star rating because in the background every developer would rate his own app 5 stars.
The ratingbar is something you can use within your app, like to ask the users what they think about it and then you can send the result to yourself or something like that to have an oversight how your users rate your app.
 
Upvote 0

GMan

Well-Known Member
Licensed User
Longtime User
I know that is WAS possible some years ago
 
Upvote 0

Alexander Stolte

Expert
Licensed User
Longtime User
Ich antworte mal auf Deutsch, da ich mich da besser ausdrücken kann. Mir kam die Idee von dem View, als ich in einer Wallpaper App eine RatingBar gesehen hab, wo man die Bilder bewerten konnte. Das View hat nichts mit dem Google Play Store zutun, in manchen Apps hab ich bereits gesehen wo man bewerten konnte und anschließend öffnete sich der Playstore wo man dann aber noch Manuell eine Bewertung abgeben musste. Es gab zwar schon so ein View im Forum, aber nur für Android, meine RatingBar ist aber Plattform-übergreifend und komplett in XUI geschrieben.

I answer in German, because I can express myself better there. I got the idea for the View when I saw a RatingBar in a Wallpaper App, where you could rate the pictures. The View has nothing to do with the Google Play Store, in some apps I already saw where you could rate and then the Playstore opened where you had to rate manually. There was already such a view in the forum, but only for Android, but my RatingBar is cross-platform and completely written in XUI.

Screenshot_20200514-143645.jpg
 
Upvote 0

GMan

Well-Known Member
Licensed User
Longtime User
Thanks for your answer.
i am answering in english (but i am also native german) - otherwise Klaus or Erel will give us a head-nut 😅
Your are rigth that in the old version you have to enter text at the Playstore, but IMHO the Rating was transfered correct to the Playstore-Stars.

So i look forward, i found that wass a nice feature.

@others: how can a "hacker" give more then 1 rating ?
The rating is connected with your (a) account.
 
Upvote 0

JohnC

Expert
Licensed User
Longtime User
What I have seen in some apps is that the app would ask the user for a rating (and display a rating bar like this), and *only* if the user selected 4-5 stars, the app would then say "Since you love this app, it would be greatly appreciated if you could leave a review in the playstore", and then jump the user to the app's page in the play store so they can leave an [obvious] good review.

This way, if the user selected anything less then 4 stars, the app would NOT suggest to the user to leave a review. In this case, maybe the app would open a comment dialog so the user can explain what why they don't love the app, and their response gets emailed directly to you.
 
Last edited:
Upvote 0

GMan

Well-Known Member
Licensed User
Longtime User
I managed it this way.
When a user selects 3 or more stars (trains in my app) i use this Sub to call the external browser with a given url from the AppStore entry

B4X:
Sub OpenBrowser(URL As String)
    Dim pm As PackageManager
    Dim i As Intent
    i.Initialize(i.ACTION_VIEW, URL)
    i.SetType("text/html")
    i.AddCategory("android.intent.category.BROWSABLE")
    Dim activities As List = pm.QueryIntentActivities(i)
    For Each cn As String In activities
        i.SetComponent(cn)
        If cn == "com.android.browser/.BrowserActivity" Then
            Exit
        End If
    Next
    StartActivity(i)
End Sub

The call is simple
B4X:
OpenBrowser("https://play.google.com/store/apps/details?id=here.your.package")
 
Upvote 0

Marvel

Active Member
Licensed User
Like John C wrote Most in app rating bar I've seen only use it to get users rating before going to the playstore. If thd the user rates it below four, it doesn't open the playstore if it is 4 and above it opens the playstore.

It's just a way of getting feedback before the user broadcasts it to the public and affects your rating
 
Upvote 0
D

Deleted member 103

Guest
What I have seen in some apps is that the app would ask the user for a rating (and display a rating bar like this), and *only* if the user selected 4-5 stars, the app would then say "Since you love this app, it would be greatly appreciated if you could leave a review in the playstore", and then jump the user to the app's page in the play store so they can leave an [obvious] good review.

This way, if the user selected anything less then 4 stars, the app would NOT suggest to the user to leave a review. In this case, maybe the app would open a comment dialog so the user can explain what why they don't love the app, and their response gets emailed directly to you.
Hi @JohnC ,

I would like to use your approach in my app and have also developed a class with which you can check whether the user has left a review or not.
What do you think about this class, does it make sense?

The flow of my code would be:
1. intercept before closing if the App has not received a review from the user
2. dialogue to assign the stars
1614607037539.png

3. if the user selects less than 4 stars, then he asks if he wants to send an email with the reason for his choice, he does not bring him to the Play-Store and the App is closed.
4. if instead you select more than 3 stars, then you ask if you want to release a review and if so, you bring it to the Play-Store and close the App.
5. at the next App-Start (from the Starter-Service), I check if the user has really released a review and if so, he doesn't ask anymore.
 

Attachments

  • clsAppReview.bas
    3.5 KB · Views: 265
Upvote 0

JohnC

Expert
Licensed User
Longtime User
Your code looks like it is trying to scrape your app's product webpage in the google playstore to see if the user has left a review or not.

This seems like a really cool idea.👍

My only questions/concerns:

1) If the user used a regular browser to view your app's product page, then I can see this working *if* the user was logged into their google account using the web browser.
2) But even if the user was logged into their google account in lets say their chrome browser, will the httpjob result reflect this and get the same result? Meaning, will the playstore page know that the user is logged in when using httpjob to retrieve the playstore page?
3) As with other webpage scrapers, if google ever changes the format of the product page, it may break the ability to determine if a review was left by the user or not.
 
Upvote 0
D

Deleted member 103

Guest
2) But even if the user was logged into their google account in lets say their chrome browser, will the httpjob result reflect this and get the same result? Meaning, will the playstore page know that the user is logged in when using httpjob to retrieve the playstore page?
In my class it is only checked whether the variable "ratingCount" has added a number and whether the variable "ratingValue" has become larger or smaller.

if google ever changes the format of the product page, it may break the ability to determine if a review was left by the user or not.
yes, unfortunately that is a problem.
The only thing you can do is check if something has changed.
 
Upvote 0

JohnC

Expert
Licensed User
Longtime User
Sounds good!
 
Upvote 0

JohnC

Expert
Licensed User
Longtime User
...you can use the new in-app review API.
The only potential problem that I can think of is that API gives total control over to google and google uses some algorithm to decide when to prompt the user or not. Meaning it's not guaranteed that calling the api will definitely cause a rating prompt to be displayed to the user.

I believe google suggests that your app should call this api on a regular basis, and google will eventually decide when its time to prompt the user. And after it prompts the user and they either select a rating or select "Don't ask me again", it sets some flag to indicate never prompt the user again (so your app can continue to keep calling the API without worry that it's bothering the user).

I even think I remember reading that google specifically prohibits calling their api if:
1) After asking the user how they would rate your app, and then only calling the API if it's a high number.
2) Telling the user to "Please make sure you leave us a high rating on the next screen" right before calling the API.

However, I feel using the API in a specific way can still be beneficial vs. your own built-in ratings bar because if you use your own rating bar then send the user over to the playstore to leave the actual rating, this would result in a TWO step process in which the user has to rate your app twice, once in your app, then again in the playstore. Which is not a good UX.

So, what I would probably do is configure my app to not have any built-in ratings bar, and also initially not call the google API. My app would instead count the number of times the user runs my app. Then when the count gets to something significant, like 100, then I'll trigger my app to start calling the google api on a regular basis. This way, by waiting until the user runs my app 100 times, I can sort of be confident that they like the app because they keep using it :) And then at some point, with my app keep calling the google api, it will result in google's ratingbar appearing and the user will then only have to rate the app once.

Alternatively, if you want total control of when the prompt will appear to the user, you could "wait until 100 runs", then use Filippo's routine to see if they already left a review, and if not, then prompt them if they want to and then send them to the store page to do so.
 
Last edited:
Upvote 0
D

Deleted member 103

Guest
However, I feel using the API in a specific way can still be beneficial vs. your own built-in ratings bar because if you use your own rating bar then send the user over to the playstore to leave the actual rating, this would result in a TWO step process in which the user has to rate your app twice, once in your app, then again in the playstore. Which is not a good UX.
After reading this, my idea doesn't look that good anymore.

5. at the next App-Start (from the Starter-Service), I check if the user has really released a review and if so, he doesn't ask anymore.
This control cannot really work, because before the next app start, someone else may have left a rating, and then my app doesn't know by whom this rating is.
I believe that it is better Google Api, just as you described to use it.
 
Upvote 0

JohnC

Expert
Licensed User
Longtime User
Upvote 0
D

Deleted member 103

Guest
I forgot about the new API and when Computersmith64 just posted about it, I remembered my plan on how I was going to use it.

I am now testing the "InAppReview" library and only starting "LaunchReview" after the user has used the app 20 times.
B4X:
Sub Activity_Create(FirstTime As Boolean)
...
    If FirstTime = True Then       
          Dim count As Int = Starter.manager.getString("intAppStartCounter")
          Starter.manager.setString("intAppStartCounter", count + 1)
    End If

    If GetSDKversion >= 21 And Starter.manager.getString("intAppStartCounter") > 20 Then
        InAppReview.Initialize("InAppReview", False)
        InAppReview.LaunchReview
    End If
...
End Sub

Now I notice that the sub "Sub InAppReview_OnComplete" is executed after every app start.
Is that normal, or do you have to ensure that the "LaunchReview" function is no longer executed?
 
Upvote 0

JohnC

Expert
Licensed User
Longtime User
Now I notice that the sub "Sub InAppReview_OnComplete" is executed after every app start.
Is that normal, or do you have to ensure that the "LaunchReview" function is no longer executed?
I have not used the API yet, but if I had to take a guess, I would think that the event is normal and it is a way for your app to know when it's ok for your app to resume interacting with the user again. This way, just in case google's algorithm did trigger a ratings pop to the user when you call that API, your app should not try to interact with the user until after that event fires (to prevent conflicts).

And as far as I understand, it's ok for your app to keep calling the LaunchReview even after the user leaves a rating because from what I understand, google will keep track if the user left a rating or not (or selected "Don't ask me again") and will simply skip over prompting the user anymore and just trigger the xxx_Complete event)
 
Upvote 0
Top