【问题标题】:Is there a way to link to all of a developer's Google Play Store apps?有没有办法链接到开发者的所有 Google Play 商店应用程序?
【发布时间】:2012-11-29 17:01:31
【问题描述】:

在我的应用中,我希望允许用户打开 Google Play 商店以查看我的所有其他应用。在 iOS 中,我只是使用以下(示例)iTunes 链接将它们全部拉起:

https://itunes.apple.com/us/artist/electronic-arts/id284800461?mt=8

有没有办法让我的所有应用程序都显示(除了搜索我的公司名称,这是相当通用的)?

【问题讨论】:

    标签: android google-play


    【解决方案1】:

    搜索产品,包括pub: 标签,可以在名为Linking to your products 的API 页面上找到。请注意,通过 URL 进行搜索需要不同的方法。两者都包括在这里。像这样开始一个意图:

    try {
        startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://search?q=pub:Developer+Name+Here")));
    } catch (android.content.ActivityNotFoundException anfe) {
        startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://play.google.com/store/apps/developer?id=Developer+Name+Here")));
    }
    

    请注意,该市场不适用于模拟器,因此此代码将改为在 URL 中提取它。此方法由this answer 提供。

    【讨论】:

    • 我收到“ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=market://developer?id=abc }”
    • 在我的 4.2 设备上没有。
    • market://details?id= 工作得很好。将其更改为开发人员会导致崩溃。
    • 开发者 ID 是唯一的吗?如何确保搜索结果不包含与我同名的任何其他开发者的应用?
    【解决方案2】:

    只需使用 developer 参数即可。这是谷歌的快捷方式

    https://play.google.com/store/apps/developer?id=Google+Inc.

    Google's Apps

    如果有空格,就在作品之间加一个+

    【讨论】:

    • 未找到也有/没有空格和点
    【解决方案3】:

    Android 实际上有更好的方法来处理这个问题。

    您还可以按包名称对所有应用程序进行分组,前提是您有足够的纪律来实际考虑它。例如,如果我所有的应用程序都以 com.mycompanyname.androidappname 开头,我可以简单地搜索 https://play.google.com/store/search?q=com.mycompanyname.*

    【讨论】:

    • 这就像一个魅力。我用它来链接到我的应用程序的一个子集,对他们来说,我有一个“子域”,即 com.mycompanyname.someofmyapps
    【解决方案4】:
    【解决方案5】:

    你可以用这个,它对我有用

    private void moreApps(Context context, int devName){
            try {
                context.startActivity(new Intent(Intent.ACTION_VIEW,
                        Uri.parse(context.getString(R.string.url_market_search_app)
                                + context.getString(devName))));
            } catch (android.content.ActivityNotFoundException anfe) {
                try {
                    context.startActivity(new Intent(Intent.ACTION_VIEW,
                            Uri.parse(context.getString(R.string.url_playstore_search_app)
                                    + context.getString(devName))));
                } catch (Exception e) {
                    Toast.makeText(context,
                            R.string.install_google_play_store,
                            Toast.LENGTH_SHORT).show();
                }
            }
    
    }
    

    【讨论】:

    • 请不要在没有解释的情况下发布代码作为答案。试着解释你的代码做了什么以及它是如何解决问题的。带有解释的答案通常更有帮助,质量更高,更有可能吸引投票。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-03-21
    • 1970-01-01
    • 1970-01-01
    • 2015-10-01
    • 2014-01-15
    • 1970-01-01
    • 2021-01-22
    相关资源
    最近更新 更多