安卓手机软件内发布google play的评分和反馈
用户可以在手机应用里向google play store发布评分(1星到5星)和反馈,而无需打开google play再操作。
硬件需求
安卓系统:安卓5.0(API level 21)或更高版本内,安装了google play store
chrome OS: 安装了google play store
Library
1.8.0 或更高版本的 play core library
dependencies {
// Java & Kotlin
implementation 'com.google.android.play:core:1.9.0'
// Kotlin
implementation 'com.google.android.play:core-ktx:1.9.0'
}
使用方法
创建 ReviewManager
ReviewManager manager = ReviewManagerFactory.create(context)
创建请求
ReviewManager manager = ReviewManagerFactory.create(this);
Task<ReviewInfo> request = manager.requestReviewFlow();
request.addOnCompleteListener(task -> {
if (task.isSuccessful()) {
// We can get the ReviewInfo object
ReviewInfo reviewInfo = task.getResult();
} else {
// There was some problem, continue regardless of the result.
}
});
打开in-app review
Task<Void> flow = manager.launchReviewFlow(activity, reviewInfo);
flow.addOnCompleteListener(task -> {
// The flow has finished. The API does not indicate whether the user
// reviewed or not, or even whether the review dialog was shown. Thus, no
// matter the result, we continue our app flow.
});
因为lambda不被支持,所以看到报错提示后,选择用匿名类代替lambda表达式。
测试
该功能只有发布于google play store以后才能使用,所以这里的测试指的是发布软件之前的测试方法。
Test using an internal test track
在google console里,面向特定的用户展开测试。首先我们需要一个开发者账号,如果没有账号的可以在https://play.google/console/u/0/signup注册开发者账号。有账号的朋友们便可以直接登录进入google play console.
第一步,在google play console里创建应用。需要填写软件名称,语言设置等基本设置。
第二步,Testing > Internal testing > create email list 创建内部测试。有open test(从google play里找到),closed test(通过邮箱管理)或者internal test(最多100人)。以internal test内部测试为例,设置选择测试人员。 可以通过逗号把邮箱地址隔开,写完后点击回车就可以;或者直接上传写好邮箱地址的CSV文件,每行写一个邮箱地址。
第三步,create new release。选择releases标签,上传Android App Bundles (.aab) 或者APK。android studio 中 可发布版本的apk生成方式:工具栏中选择 build > generate signed bundle/apk > Apk
最后,把apk上传到google play console里,然后回答些问题(比如目标用户的年龄段,应用里是否有暴力等内容之类的问题),就可以发布测试版本了。
测试发布完成后,需要经过审核才能发布。我的alpha测试于14号上传,今天是18号才经过review。然后点开详情,会有一个分享app的链接,只有指定用户(gmail账户登陆的google play)才能打开链接并下载软件。下载的时候,会提示说需要允许internal test才行。具体的操作是:在google play里打开settings, 找到play store version, 点击七次,然后奇迹就发生啦!第一次发布软件(虽然是个内测版本而已),但还是满满的成就感。尤其是点击7次看到奇迹发生的那一刻,就仿佛是谷歌公司在给自己颁发认证一般,觉得自己仿佛在那一秒钟正式成为一名开发人员。继续努力,未来可期!
建议
- 在用户有足够使用经验来提供有效反馈的时候再调用此功能
- 不要过于频繁的邀请用户去评价
- 在用户评级之前,不应该被提问任何其他问题,例如“你是否会评五星”等问题
参考
https://developer.android/guide/playcore/in-app-review#design-guidelines
https://developer.android/guide/playcore
https://developer.android/guide/playcore/in-app-review/test
https://developer.android/distribute/best-practices/launch/test-tracks
更多推荐
安卓 Google Play In-App Review API 使用建议
发布评论