【问题标题】:Android Web App working only on some devicesAndroid Web App 仅适用于某些设备
【发布时间】:2018-04-10 16:56:27
【问题描述】:

我有一个 web 应用程序,可以控制我的 Raspberry 上的一些功能,但我的所有 Android 设备都无法识别它。网站服务器是带有 Apache 的 Raspberry Pi 3(都是最新的)。

出于隐私/安全原因,所有 IP 地址都更改为简单的 000.000.000.000

我可以通过 Chrome 中的“添加到主页”选项轻松地将 web 应用程序添加到我的三星 S7 中,并且它运行顺利,但是在我所有其他家庭 Android(和 iOS)设备上却没有,它只是作为一个链接到家。

这是它在我的 S7 上的显示方式: homescreen (it gets the icon) inside the webapp

这是 manifest.json 代码:

{
  "name": "Casa TAM Domotica",
  "short_name": "CasaControl",
  "theme_color": "#008eff",
  "background_color": "#085491",
  "display": "standalone",
  "orientation": "portrait",
  "start_url": "000.000.000.000",
  "icons": [
    {
      "src": "images/icons/icon-72x72.png",
      "sizes": "72x72",
      "type": "image/png"
    },
    {
      "src": "images/icons/icon-96x96.png",
      "sizes": "96x96",
      "type": "image/png"
    },
    {
      "src": "images/icons/icon-128x128.png",
      "sizes": "128x128",
      "type": "image/png"
    },
    {
      "src": "images/icons/icon-144x144.png",
      "sizes": "144x144",
      "type": "image/png"
    },
    {
      "src": "images/icons/icon-152x152.png",
      "sizes": "152x152",
      "type": "image/png"
    },
    {
      "src": "images/icons/icon-192x192.png",
      "sizes": "192x192",
      "type": "image/png"
    },
    {
      "src": "images/icons/icon-384x384.png",
      "sizes": "384x384",
      "type": "image/png"
    },
    {
      "src": "images/icons/icon-512x512.png",
      "sizes": "512x512",
      "type": "image/png"
    }
  ],
  "splash_pages": null
}

这是 index.php 代码:

<?php

$c=$_GET['c'];
$r=$_GET['r'];
$g=$_GET['g'];
$b=$_GET['b'];


/* after every raspberry pi reboot it must execute pigpiod*/
$execute = shell_exec("pigpiod");

if($c == 1)
{
        $execute = shell_exec("pigpiod");
        $execute = shell_exec("pigs w 12 0");
        sleep(1);
        $execute = shell_exec("pigs w 12 1");
    header('Location: 000.000.000.000');
}

if($r != "" AND $g != "" AND $b != "")
{
        $execute = shell_exec("pigpiod");
        $execute = shell_exec("pigs p 22 $r");
        $execute = shell_exec("pigs p 27 $g");
    $execute = shell_exec("pigs p 17 $b");
        header('Location: 000.000.000.000');
}


?>

<!DOCTYPE html>
<html lang="en">
<body bgcolor="#000000">
<head>
<body scroll="no" style="overflow: hidden">
<meta name="viewport">
<meta name="mobile-web-app-capable" content="yes">
<style>
.button {
    background-color: #e7e7e7;
    border: none;
    color: white;
    padding: 20px 50px;
    text-align: center;
    text-decoration: none;
    display: inline-block;
    font-size: 24px;
    margin: 1px 1px;
    cursor: pointer;
    width: 100%;
    color: black;
    font-family: Arial, Helvetica, sans-serif;
}

.button0 {
        background-color: #e7e7e7;
        border: none;
        color: white;
        padding: 50px;
        display: inline-block;
}


.buttonblu {background-color: #008CBA;}
.buttonrosso {background-color: #f44336;}
.buttonverde {background-color: #4CAF50;}
.buttonviola {background-color: #896D93;}
.buttonarancione {background-color: #FFA500;}
.buttongiallo {background-color: #FFFF00;}
.buttonrosa {background-color: #FEB5B5;}
.buttonbianco {background-color: #FFFFFF;}


</style>
    <meta name="mobile-web-app-capable" content="yes">
    <link rel="manifest" href="manifest.json">
    <link rel="icon" href="ico.ico">
        <meta charset="utf-8" />
        <title>Apertura cancello TAM</title>
        <script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
        <script>
        function show(id) {
                if(document.getElementById) {
                        var mydiv = document.getElementById(id);
                        mydiv.style.display = (mydiv.style.display=='block'?'none':'block');
                }
        }
        </script>
        <style>
                body {
                        width:50%;
                        padding-top:5%;
                        margin:auto;
                }
        </style>
</head>
<body>
<p>
<center><a href="index.php?c=1"  class="button"><font size="100">Apertura Cancello</font></a></center>

<a href="index.php?r=0&g=140&b=186"  class="button0 buttonblu"></a>
<a href="index.php?r=244&g=67&b=54"  class="button0 buttonrosso"></a>
<a href="index.php?r=76&g=175&b=80"  class="button0 buttonverde"></a>
<a href="index.php?r=137&g=109&b=147"  class="button0 buttonviola"></a>
<a href="index.php?r=255&g=165&b=0"  class="button0 buttonarancione"></a>
<a href="index.php?r=255&g=255&b=0"  class="button0 buttongiallo"></a>
<a href="index.php?r=254&g=181&b=181"  class="button0 buttonrosa"></a>
<a href="index.php?r=155&g=155&b=155"  class="button0 buttonbianco"></a>
</p>
<IFRAME src="000.000.000.000/cam_pic_new.php" align="center" width="1080" height="810" scrolling="no" frameborder=0 marginheight="0px"</IFRAME>

有什么办法吗?

【问题讨论】:

    标签: php android html json web-applications


    【解决方案1】:

    修复它,manifest.json 并不总是被系统读取,我添加了更多的实例

    <link rel="manifest" href="manifest.json">
    

    解决问题

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-10-11
      • 2018-02-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多