【问题标题】:Android Intent for deep-linking to Deezer Search用于深度链接到 Deezer Search 的 Android Intent
【发布时间】:2015-03-24 14:40:31
【问题描述】:

我正在尝试通过发送以下意图在 Deezer 上执行搜索:

Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.deezer.com/search/" + query));
this.startActivity(intent);

在以前的版本中,Web 浏览器打开时会显示“在 Deezer 中打开”(或类似名称)的链接。 但是在当前版本中,这不再起作用了。

有什么方法可以打开 Deezer 应用程序并执行搜索? 我已经尝试了以下方法(没有成功):

Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("deezer://search/" + query));
this.startActivity(intent);

【问题讨论】:

    标签: android android-intent uri deezer android-implicit-intent


    【解决方案1】:

    您可以使用许多深层链接在 Deezer 应用程序中搜索内容。你确实有这样的基本搜索:

    Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("deezer://www.deezer.com/search/" + query));
    this.startActivity(intent);
    

    但你也可以更精确:

    // Search for an artist, will display the best match
    Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("deezer-query://www.deezer.com/artist?query" + query));
    this.startActivity(intent);
    
    // Search for an album, will display the best match
    Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("deezer-query://www.deezer.com/album?query" + query));
    this.startActivity(intent);
    
    // Search for a track, will display the best match
    Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("deezer-query://www.deezer.com/track?query" + query));
    this.startActivity(intent);
    

    【讨论】:

      【解决方案2】:

      我认为应该是

      Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("deezer://www.deezer.com/search/" + query));
      this.startActivity(intent);
      

      Uri 中的scheme 必须是deezer。您已将其设置为http

      试试这个。这应该可以。

      【讨论】:

        猜你喜欢
        • 2019-03-12
        • 2021-09-18
        • 2014-02-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多