本文介绍了“评价此应用程序"-手机上 Google Play 商店应用程序中的链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!
问题描述
我想在 Android 应用中添加评价此应用"链接,以便在用户手机上的 Google Play 商店应用中打开应用列表.
I'd like to put a "Rate This App"-link in an Android App to open up the app-listing in the user's Google Play store app on their phone.
- 我必须编写什么代码才能在手机上的 Google Play 商店应用中创建
market://或http://-链接? - 您将代码放在哪里?
- 有人有这方面的示例实现吗?
- 您是否必须指定
market://或http://链接将放置在哪个屏幕上,哪个最好使用 -market://还是http://?
- What code do I have to write to create the
market://orhttp://-link open in the Google Play store app on the phone? - Where do you put the code?
- Does anyone have a sample implementation of this?
- Do you have to specify the screen where the
market://orhttp://link will be placed, and which is the best to use -market://orhttp://?
推荐答案
我使用以下代码从我的应用打开 Play 商店:
I open the Play Store from my App with the following code:
val uri: Uri = Uri.parse("market://details?id=$packageName")
val goToMarket = Intent(Intent.ACTION_VIEW, uri)
// To count with Play market backstack, After pressing back button,
// to taken back to our application, we need to add following flags to intent.
goToMarket.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY or
Intent.FLAG_ACTIVITY_NEW_DOCUMENT or
Intent.FLAG_ACTIVITY_MULTIPLE_TASK)
try {
startActivity(goToMarket)
} catch (e: ActivityNotFoundException) {
startActivity(Intent(Intent.ACTION_VIEW,
Uri.parse("http://play.google.com/store/apps/details?id=$packageName")))
}
选项 2:是使用resolveActivity而不是try..catch
Option 2: is to use resolveActivity instead of try..catch
if (sendIntent.resolveActivity(getPackageManager()) != null) {
startActivity(chooser);
} else {
openUrl();
}
这篇关于“评价此应用程序"-手机上 Google Play 商店应用程序中的链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!
The End


大气响应式网络建站服务公司织梦模板
高端大气html5设计公司网站源码
织梦dede网页模板下载素材销售下载站平台(带会员中心带筛选)
财税代理公司注册代理记账网站织梦模板(带手机端)
成人高考自考在职研究生教育机构网站源码(带手机端)
高端HTML5响应式企业集团通用类网站织梦模板(自适应手机端)