【问题标题】:Android Native App Install Banner Is Not WorkingAndroid 本机应用程序安装横幅不起作用
【发布时间】:2016-08-25 18:52:07
【问题描述】:

我正在尝试在我的网站上为我的 Android 应用获取本机应用安装横幅。我的 manifest.json 看起来像这样:

{
    "short_name": "App Name",
    "icons": [
        {
            "src": "launch-icon.png",
            "sizes": "144x144",
            "type": "image/png"
        }
    ],
    "prefer_related_applications": true,
    "related_applications": [
        {
            "platform": "play",
            "id": "my.app.id"
        }
    ]
}

满足所有条件列表here:

  • 通过 HTTPS 提供服务
  • 短名称
  • 144x144 图标

我正在通过设置 chrome 标志跳过参与度检查以进行测试:

chrome://flags/#bypass-app-banner-engagement-checks

我尝试了example page,它按预期工作,即横幅显示。但是,我看不出我的清单设置方式与示例中的设置方式有什么区别。我已使用远程调试来验证清单文件是否已获取。

【问题讨论】:

  • 您是否尝试过不跳过参与度检查?检查您的代码是否正常工作。
  • 是的,我正在绕过参与度检查
  • 您知道如何解决吗? 1. service-worker.js 是强制添加的吗? 2. start_url 应该是什么?我有项目-> 视图-> .cshtml。我在这个 html 中添加了链接标签 我在 Project -> manifest.json 中有我的 .json 3. 横幅会显示在开发工具或模拟器中吗?还是只在手机上?
  • 您是否尝试过先“卸载”相关应用?
  • 他们忘记提及的一件事,但在他们的示例页面上指出,安装横幅需要 24 小时或 1 天才能显示。它在 24 小时后开始在我的身上工作。我将 manifest.json 文件放在我的 MVC 5 应用程序的根目录之外的单独文件夹中,因此根目录中没有该文件并不重要。我还检查以确保 Chrome 能够显示我的 manifest.json 文件的内容。示例页面在这里。 googlechrome.github.io/samples/app-install-banner/…

标签: android google-chrome progressive-web-apps


【解决方案1】:

看起来你已经大部分遇到了requirements。缺少一个标准:需要多个不同的图标大小。这些尺寸是36x3648x4872x7296x96144x144192x192

另外,start_url 可以是. 来设置当前路径。

这是一个例子:

{
  "name": "App Name",
  "short_name": "App Name Install Banner Sample",
  "icons": [
    {
      "src": "icon-0-75x.png",
      "sizes": "36x36",
      "type": "image/png"
    },
    {
      "src": "icon-1x.png",
      "sizes": "48x48",
      "type": "image/png"
    },
    {
      "src": "icon-1-5x.png",
      "sizes": "72x72",
      "type": "image/png"
    },
    {
      "src": "icon-2x.png",
      "sizes": "96x96",
      "type": "image/png"
    },
    {
      "src": "icon-3x.png",
      "sizes": "144x144",
      "type": "image/png"
    },
    {
      "src": "icon-4x.png",
      "sizes": "192x192",
      "type": "image/png"
    }
  ],
  "prefer_related_applications": true,
  "related_applications": [
    {
      "platform": "play",
      "id": "com.google.samples.apps.iosched",
      "url": "https://play.google.com/store/apps/details?id=com.google.samples.apps.iosched"
    }
  ],
  "start_url": ".",
  "display": "standalone"
}

提醒一下:

  1. 在 chrome 中启用此标志 chrome://flags/#bypass-app-banner-engagement-checks
  2. 在您的 Android 设备或模拟器上登录 Google Play(确保模拟器具有 Play 商店)
  3. 该应用不应已安装在设备上
  4. 关注requirements listed at the top here
  5. 检查浏览器中的源选项卡以查看清单是否正确提供,并记得检查控制台是否有任何错误(警告很好)

【讨论】:

    【解决方案2】:

    首先,使用this answer 进行故障排除。

    其次,确保该应用尚未安装。

    第三,如果您在模拟器上进行测试,请确保您已实际登录 Play Store 应用。

    【讨论】:

      猜你喜欢
      • 2017-03-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-01-31
      • 1970-01-01
      相关资源
      最近更新 更多