代码之家  ›  专栏  ›  技术社区  ›  mafortis

从Google play商店获取已发布应用程序列表

  •  0
  • mafortis  · 技术社区  · 5 年前

    我想在我的应用程序中进行活动,显示我创建并发布给用户的其他应用程序的列表,我的问题是:

    我是否有可能在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
        }
    }
    

    这让我在点击活动链接时可以在浏览器中打开链接,我想要的是在活动片段中显示我的应用程序列表,而不是在浏览器中开启网页。

    对此有什么想法吗?

    1 回复  |  直到 5 年前
        1
  •  1
  •   DisappointedByUnaccountableMod brnfd    4 年前

    到目前为止,我还没有找到任何 api 在Google play中获取已发布的应用程序列表。。 然而,我试图建立一个 刮板 为您获取列表,但首先失败,也许谷歌会在几分钟后重定向到登录/登录页面 http 调用,例如使用url: https://play.google.com/store/apps/dev?id=0000000000000000000 .尝试过: openConnection() 属于 URL 类&; Jsoup .

    这个想法是 获取应用程序名称、img&url。然后,我们可以将其设置为回收器视图。

    :(

    编辑: 作为一种变通方法。。 您可以设置 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)
    

    查看:

    <WebView
            android:id="@+id/webview"
            android:layout_width="match_parent"
            android:layout_height="match_parent" />
    

    More by google

        2
  •  0
  •   Paolo Colombo    5 年前

    您需要在游戏控制台中设置您的开发人员页面(设置->开发人员页面),然后可以使用Intent调用它

    Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/dev?id=8408908814286885702"));
        startActivity(i);