为网站创建一个 Android 启动图标

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/22167594/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 05:36:13  来源:igfitidea点击:

Create a Android launch icon for Website

androidlauncher

提问by Anoop Halgeri

I have a responsive website which can be accessed across multiple devices, our design and application is mainly targeted for mobile users.

我有一个可以跨多种设备访问的响应式网站,我们的设计和应用程序主要针对移动用户。

To ease access to the site, we want to create a launch icon which will apear on the mobile home screen and user can access the site using one touch, as against launching the browser and typing the url / opening the bookmarked page.

为了方便访问该站点,我们希望创建一个启动图标,该图标将出现在移动主屏幕上,用户只需轻轻一按即可访问该站点,而不是启动浏览器并输入 url/打开书签页面。

I found a solution for it in IOS, which is also supported by the safari browser using which you can save the page url as a launch icon, can a similar feature be found on a android device? I would also be interested in prompting the users to create the launch icon if they are accessing it from a mobile phone /tablet.

我在 IOS 中找到了一个解决方案,Safari 浏览器也支持该解决方案,使用它您可以将页面 url 保存为启动图标,在 android 设备上可以找到类似的功能吗?如果用户从手机/平板电脑访问它,我也有兴趣提示用户创建启动图标。

采纳答案by hcpl

Default Android

默认安卓

This is the preferred way since this is all based on default Android options and doesn't add any maintenance.

这是首选方式,因为这完全基于默认的 Android 选项,并且不添加任何维护。

As a widget from bookmarks

作为书签中的小部件

If on android you long press the home screen and then select the widget option you can create a bookmark. This will let you select a bookmark from your chrome bookmarks to be linked on the desktop. If that works for you you're all set with default Android features. The icon from the bookmark is used on the desktop.

如果在 android 上长按主屏幕,然后选择小部件选项,您可以创建书签。这将允许您从要链接到桌面的 chrome 书签中选择一个书签。如果这对你有用,你就已经设置好了默认的 Android 功能。书签中的图标用于桌面。

Directly from Chrome

直接从 Chrome

Similar to this approach is selecting the "Add to homescreen" option in the chrome settings menu.

与此方法类似的是在 chrome 设置菜单中选择“添加到主屏幕”选项。

Adding a screenshot to desktop from Chrome

从 Chrome 添加屏幕截图到桌面

The icon is the icon from the website.

该图标是来自网站的图标。

Icon as shown on the desktop

桌面上显示的图标

Custom alternative

自定义替代

As stated before the alternative is to create an app that only serves the purpose of being a link to your mobile website. Then you have 2 options:

如前所述,另一种方法是创建一个应用程序,该应用程序仅用作连接到您的移动网站的目的。那么你有2个选择:

Using default browser of user

使用用户的默认浏览器

An app that uses intents to open the default browser of the user with your URL. This should be the way to go since the user can now keep on using his favorite browser.

使用 Intent 使用您的 URL 打开用户的默认浏览器的应用程序。这应该是要走的路,因为用户现在可以继续使用他最喜欢的浏览器。

In app browser

在应用浏览器中

An app that contains a single webview loading the URL of your webapp. This last option gives you more control over the browsing experience (blocking scripts, overriding requests, ...). However the user can no longer use his preferred browser.

包含单个 webview 的应用程序,用于加载您的 web 应用程序的 URL。最后一个选项使您可以更好地控制浏览体验(阻止脚本、覆盖请求等)。然而,用户不能再使用他喜欢的浏览器。

About the icon

关于图标

In both cases the Icon will be the icon configured and distributed within the app. This also introduce the need of a new app release if the icon or the URL should change.

在这两种情况下,图标都是在应用程序中配置和分发的图标。如果图标或 URL 发生变化,这也会引入新的应用程序版本的需求。

About the code

关于代码

Code examples and information about this webapp in app approach can be found at http://developer.android.com/guide/webapps/webview.html

可以在http://developer.android.com/guide/webapps/webview.html上找到有关此 webapp in app 方法的代码示例和信息

Another good resource is https://developers.google.com/chrome/mobile/docs/webview/overviewwhere mobile app development using a native android app with webview is covered with several aspects like tools, css tricks and more.

另一个很好的资源是https://developers.google.com/chrome/mobile/docs/webview/overview,其中使用带有 webview 的原生 android 应用程序开发移动应用程序涵盖了几个方面,如工具、css 技巧等。

回答by Paresh Mayani

If I have understood your issue exactly then you would want to show a launcher icon for your website without creating any activity (screen) or doing any programming in android.

如果我完全理解您的问题,那么您会希望在不创建任何活动(屏幕)或在 android 中进行任何编程的情况下为您的网站显示启动器图标。

If this is the case then my answer is YES, as depicted in snap Google chrome provides this functionality to create a launcher/app icon on home screen.

如果是这种情况,那么我的答案是肯定的,如 snap Google chrome 中所述,提供了此功能来在主屏幕上创建启动器/应用程序图标。

enter image description here

在此处输入图片说明

回答by Sami Eltamawy

Some webBrowserslike chromeenable the user to make a bookmark for a specific URLas an icon in the home screen, but I did not get evolved in a project like that. So it is possible.

有些人webBrowsers喜欢chrome让用户可以URL在主屏幕上为特定的图标制作书签,但我并没有在这样的项目中得到发展。所以这是可能的。

You can make it simple by creating an application that contain only a webviewto open your urland you can then create an icon for your app that hold the website on the home screen as the following in this answer

你可以把它简单的通过创建只包含一个应用程序的WebView打开你的url,你就可以创建你的应用程序,按住主屏幕上的网站,在这个下面的图标答案

回答by chrki

In my 3 years on Android I have never seen a website ask me to make a shortcut on my homescreen, however, the standard Android browser as well as Dolphin can create shortcuts from bookmarks.

在我使用 Android 的 3 年中,我从未见过网站要求我在主屏幕上创建快捷方式,但是,标准的 Android 浏览器和 Dolphin 可以从书签创建快捷方式。

While researching this with a quick search I found this threadstates that Chrome allows this as well, and there's even a way to specify a homescreen icon for your users.

在通过快速搜索进行研究时,我发现该线程指出 Chrome 也允许这样做,甚至还有一种方法可以为您的用户指定主屏幕图标。