android - 如何测试 native 应用程序安装横幅是否有效

标签 android json testing mobile

大家好,

我做了一个 Native app install banner我的网站满足以下条件:

  • 拥有网络应用程序 list 文件。
  • 通过 HTTPS 提供服务。

我的 manifest.json文件也满足这个额外的标准:

  • 一个short_name .
  • 名称(在横幅提示中使用)。
  • 一个 192x192 的 png 图标,你的图标声明应该包含 image/png 的 mime 类型.
  • 一个related_applications包含应用相关信息的对象。

所以我的manifest.json文件看起来像这样:

{
  "short_name": "test",
  "name": "test test",
  "prefer_related_applications": true,
  "related_applications": [
    {
    "platform": "play",
    "id": "secret"
    }
  ],
  "icons": [
    {
      "src": "appicon-192x192.png",
      "type": "image/png",
      "sizes": "192x192"
    },
    {
      "src": "appicon-96x96.png",
      "type": "image/png",
      "sizes": "96x96"
    },
    {
      "src": "appicon-48x48.png",
      "type": "image/png",
      "sizes": "48x48"
    }
  ]
}

我还添加了 <link rel="manifest" href="/manifest.json">到每一页。

所以我相信它应该一切正常,但我想确保一切正常,我该如何测试它,因为最重要的标准是:

  • 在两周内的两天内被用户访问两次。

这意味着为了测试它是否真的有效,我必须单独访问该网站 2 天。一定有其他方法吧?

我希望有人知道如何测试它。

提前致谢。

最佳答案

引用谷歌的示例页面:https://googlechrome.github.io/samples/app-install-banner/

The web app install banner user prompt that Chrome will trigger to indicate that the user can add your web app to the users home screen. It will only prompt when a number of criteria have been met:

  1. The app uses a service worker
  2. The site is using HTTPS
  3. The app has a manifest declared
  4. The manifest has a short_name, 144-pixel icon and a type of 'image/png'

根据我自己的经验,这个横幅并不像您希望的那样易于测试。

示例页面声称,但我没有发现这有助于强制显示横幅。

For testing we encourage you to force the banner to appear by setting the chrome://flags/#bypass-app-banner-engagement-checks flag.

横幅一天只会出现一次,对于用户体验来说很棒,但对于调试来说并不是很好(假设 chrome 标志不起作用)...我最终在我的测试设备上重新安装了 chrome我需要调试的时间。一位同事提出了快进系统日期/时间的想法,但我从未尝试过。

希望这对您有所帮助。

例如

关于android - 如何测试 native 应用程序安装横幅是否有效,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46954542/

相关文章:

python - 布谷鸟沙盒 : shows "Configuration details about machine windows_7 are missing" error

testing - 软断言导致后续测试失败时抛出的异常

java - 谷歌任务 API : How can I find the TaskList of a Task?

android - 消息队列中如何处理方向变化?

ASP.NET - 使用 jQuery 处理基于 JSON 的 Web 服务的正确方法是什么?

java - 测试是 JSONObject 还是 JSONArray

java - 如何修复 'android.os.NetworkOnMainThreadException' ?

android - 使用parse.com facebook登录 - 获取参数third_party_app_id必须是有效的应用程序id

java - 如何使用 json 将文件对象发送到 servlet

testing - Testcafe - 在单个声明中对所有测试调用 RequestHook?