我想在我的应用程序中进行活动,在其中显示我创建并发布给用户的其他应用程序列表,我的问题是:
是否可以在Google Play商店中获取已发布应用的列表并将其显示给用户,还是必须创建自定义活动并手动在Play商店中介绍其他应用?
这是我的片段(活动代码)
class ToolsFragment : Fragment() {
private lateinit var toolsViewModel: ToolsViewModel
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
toolsViewModel =
ViewModelProviders.of(this).get(ToolsViewModel::class.java)
val root = inflater.inflate(R.layout.fragment_tools, container, false)
//val textView: TextView = root.findViewById(R.id.text_tools)
//toolsViewModel.text.observe(this, Observer {
// textView.text = it
//})
val i = Intent(
Intent.ACTION_VIEW,
Uri.parse("https://play.google.com/store/apps/dev?id=0000000000000000000")
)
startActivity(i)
return root
}
}
这使我在单击活动链接时可以在浏览器中打开链接,我想要的是在活动片段中显示我的应用程序列表,而不是在浏览器中打开网页。
有什么想法吗?
答案 0 :(得分:1)
到目前为止,我还没有找到任何api
来获取Google Play中已发布的应用列表。
但是,我尝试构建一个抓取程序来为您获取列表,但它首先失败了,也许Google在几次http
调用后(例如,使用url:{{ 1}}。尝试过:https://play.google.com/store/apps/dev?id=0000000000000000000
类的openConnection()
和URL
。
这个想法是废弃主体并获得应用程序名称,img和URL。然后,我们将能够在回收站视图中进行设置。
:(
编辑:
只是一种解决方法。
您可以在活动/片段中设置Jsoup
,以从WebViewClient
页面加载应用。
More by developer
查看:
val webview: WebView = findViewById(R.id.webview) // or just use synthetic
val myUrl = "https://play.google.com/store/apps/developer?id=WhatsApp+Inc."
webview.webViewClient = WebViewClient()
webview.loadUrl(myUrl)
答案 1 :(得分:0)
您需要在播放控制台(设置->开发者页面)中设置开发者页面,然后可以使用Intent调用它
Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/dev?id=8408908814286885702"));
startActivity(i);