In-App Review in Android - MindOrks
文章推薦指數: 80 %
Upload your application in the internal test track and test it out. Upload your application in internal app sharing and test the review flow. CheckNowIn-AppReviewinAndroid So,youreleasedanappintheplaystoreandusersarelikingit.Butnowwewanttheuser'slikingtobeshownintheplaystoreviareviews.Butthefirstquestioniswhyweneedthereviews?Havinggoodreviewsinyourapplicationmakesalotofimpactonyourproductlikegoodrankingintheplaystoreanditalsohelpsanewusertotrustyourappmore.Buttodatewhatweusetodois,weusetoshowsomecustomtotakethemtoplaystoreandexpectuserswouldgivethereviewthere.Butithasfewissueslike,Theusermightchoosenottoaddanyreviewandjustleave.Theusermightdropfromtheappandthat'sabadpointastheuserisleavingtheapp.Wedon'twantouruserstoleavetheapplication.Tosolvetheseproblems,GooglelaunchedanIn-AppReviewAPI,asapartoftheplaycorelibrarywhichwecanusetoaddreviewsfromourapplicationitselfwithoutleavingtheapplicationandthatprovidesaverysmoothuserexperienceaswelltotheusers.Inthisblog,wearegoingtolearn,Whentoasktheusertoaddtheirreviewfortheapp.HowtointegratethenewIn-AppreviewAPI?HowtotesttheInAppReview?Whentoasktheusertoaddreviewtheapp.Consideringthattheuserhaslikedafeatureinyourapplicationorhascompletedsomelevelinyourgame,thatmightbeaplacetoshowtheReviewUItotheuser.Googlehasalsoprovidedsomeguidelinesforwherenottoaskforthereviewlike,WeshouldnotaddcustomUIalongsidetheReviewUIflow.Weshouldnotprompttheuserfrequentlyforareview,ithasquotaslimitassociatedwithit.Also,weshouldnothaveanycalltoactionlikeabuttontotriggertheIn-AppReviewAPI,theusersmighthittheirquotabytriggeringagainandagain.HowtointegratethenewIn-AppreviewAPI?Let'sstarttheintegrationoftheAPIinourapplication.Step01:AstheIn-AppReviewisapartofthePlaycorelibrary,weneedtoaddtherequireddependenciesinourapp'sbuild.gradlefilelike,implementation'com.google.android.play:core:1.8.2' implementation'com.google.android.play:core-ktx:1.8.1'Step02:Sincetheintegrationofdependenciesisdone,weneedtofigureoutthecorrectplacewhereweneedtoasktheuserforareview.Makesurethatyouaskatahappyplacewheretheuserhasachievedsomethinglike,Forexample,Ifyouareanappwhoisintherentalspacebusinessandhelppeoplegetroommatesfortheirvacantspacethenthebestplacetoaskreviewmightbewhenyouconnecttheuserwithapotentialroommate.Ifyouareagamingapp,thenmaybeshowthemaftercompletingalevelorsomethingsimilartoit.Theywouldhappilyrateyourapplicationandleaveagoodreviewastheyalreadyhadagoodexperienceforwhattheywerelookingfor.Step03:Now,sincewehavefiguredoutthebesttriggerpointtoaskforareview,letusstartintegratingtheReviewAPIitself.First,weneedtocreatetheinstanceofReviewManagerwhichwouldhelpustostarttheAPI.Wecreatetheinstanceusing,valmanager=ReviewManagerFactory.create(context)Now,usingthismanagerobjectwehavetorequesttheflowtolaunchtheIn-Appreviewflow.Wedoitlike,valrequest=manager.requestReviewFlow()Oncethisisdone,wecancheckiftherequestwassuccessfulinitsonCompleteListenerthenlet'sstartthein-appflowlike,request.addOnCompleteListener{request-> if(request.isSuccessful){ valreviewInfo=request.result }else{ //Handletheerrorhere } }AndwhenwegetthereviewInfoobject,wejuststartthereviewprocesslike,request.addOnCompleteListener{request-> if(request.isSuccessful){ valreviewInfo=request.result valflow=manager.launchReviewFlow(this,reviewInfo) flow.addOnCompleteListener{_-> //Continueyourapplicationprocess } }else{ //Handletheerrorhere } }InsidetheaddOnCompleteListener,wejustkeeptheapplication'sflowrunningirrespectiveofwhattheresultsare. ImageSource:developer.android.comNow,wearedonesettinguptheIn-AppReviewinourapplication.HowtotesttheIn-AppReview?Now,sincewehaveintegratedtheflow,weneedtotestitoutandmakesureitworksfineforus.Todoit,wehaveacoupleofwaystotestitoutlike,Uploadyourapplicationintheinternaltesttrackandtestitout.Uploadyourapplicationininternalappsharingandtestthereviewflow.Now,whiletestingitintestcasestocheckifthereviewflowiscompletedandtheapp'sflowisexecutingintheexpectedflowthenweusedFakeReviewManagerinplaceofReviewManagerFactorylike,valmanager=FakeReviewManager(this)ThiswouldnottriggertheUIbutonlytakecareoffakingtheresultbygivingusthefakeReviewInfoobject.PointtotakecareofwhileusingIn-AppReviewAPIYouwillseetheReviewUIonlyifyourprimaryaccounthasnotalreadyreviewedtheapp.HappyLearning:)HimanshuSinghShowyourlovebysharingthisblogwithyourfellowdevelopers.ShareonFacebookShareonTwitterShareonRedditShareonLinkedInShareonTelegramShareonWhatsapp
延伸文章資訊
- 1Test in-app reviews | Android Developers
In-app reviews require your app to be published in Play Store. However, you can test your integra...
- 2A Step-by-Step Guide to Easy Android in-App Review Setup.
Testing In-App review. Testing the In-App review is not as straightforward as running the app fro...
- 3Google Play In-App Review using Android Studio - Section.io
How to test · Generate a signed app bundle/APK. · Share the generated APK with a tester. · Copy t...
- 4Google Play In-App Review API | Android Developers
The Google Play In-App Review API lets you prompt users to submit Play Store ratings and reviews ...
- 5In-App Review in Android - MindOrks
Upload your application in the internal test track and test it out. Upload your application in in...