我有一个webapp控制我的Raspberry上的一些功能,但我有问题从我所有的Android设备识别它。网站服务器是带Apache的Raspberry Pi 3(全部都是最新的)。
出于隐私/安全原因,所有IP地址都以简单的000.000.000.000更改
我可以通过Chrome中的“添加到主页”选项轻松地将webapp添加到我的三星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>
任何解决方案?
答案 0 :(得分:0)
修正了它,系统并不总是读取manifest.json,我添加了更多的
实例<link rel="manifest" href="manifest.json">
解决问题