Позволяет ли Google Play открывать локальный хост для получения файлов? ⇐ Android
Позволяет ли Google Play открывать локальный хост для получения файлов?
This is my webview game, I run a localhost in the game to the local files in assets. it's all good but I want to know if I'm allowed to run Localhost or if it violates Google Play's publishing rules.
imports... webview webView.loadUrl("http://localhost:8080/index.html");... some codes... private class LocalWebServer extends NanoHTTPD { public LocalWebServer() { super(8080); } @Override public Response serve(IHTTPSession session) { String uri = session.getUri(); String mimeType = null; String fileName = uri.substring(1); // Remove the leading '/' if (fileName.endsWith(".html")) { mimeType = "text/html"; } else if (fileName.endsWith(".css")) { mimeType = "text/css"; } else if (fileName.endsWith(".js")) { mimeType = "application/javascript"; } else if (fileName.endsWith(".json")) { mimeType = "application/json"; } else if (fileName.endsWith(".png")) { mimeType = "image/png"; } else if (fileName.endsWith(".mp3")) { mimeType = "audio/mpeg"; } else if (fileName.endsWith(".m4a")) { mimeType = "audio/mp4"; } try { InputStream inputStream = getAssets().open(fileName); if (mimeType != null) { return newChunkedResponse(Response.Status.OK, mimeType, inputStream); } } catch (IOException e) { e.printStackTrace(); } return newFixedLengthResponse(Response.Status.NOT_FOUND, "text/plain", "File not found"); } } }
Источник: https://stackoverflow.com/questions/780 ... -get-files
This is my webview game, I run a localhost in the game to the local files in assets. it's all good but I want to know if I'm allowed to run Localhost or if it violates Google Play's publishing rules.
imports... webview webView.loadUrl("http://localhost:8080/index.html");... some codes... private class LocalWebServer extends NanoHTTPD { public LocalWebServer() { super(8080); } @Override public Response serve(IHTTPSession session) { String uri = session.getUri(); String mimeType = null; String fileName = uri.substring(1); // Remove the leading '/' if (fileName.endsWith(".html")) { mimeType = "text/html"; } else if (fileName.endsWith(".css")) { mimeType = "text/css"; } else if (fileName.endsWith(".js")) { mimeType = "application/javascript"; } else if (fileName.endsWith(".json")) { mimeType = "application/json"; } else if (fileName.endsWith(".png")) { mimeType = "image/png"; } else if (fileName.endsWith(".mp3")) { mimeType = "audio/mpeg"; } else if (fileName.endsWith(".m4a")) { mimeType = "audio/mp4"; } try { InputStream inputStream = getAssets().open(fileName); if (mimeType != null) { return newChunkedResponse(Response.Status.OK, mimeType, inputStream); } } catch (IOException e) { e.printStackTrace(); } return newFixedLengthResponse(Response.Status.NOT_FOUND, "text/plain", "File not found"); } } }
Источник: https://stackoverflow.com/questions/780 ... -get-files
-
- Похожие темы
- Ответы
- Просмотры
- Последнее сообщение
-
-
Я не могу продолжать открывать свой локальный веб-сайт после добавления $factory [дубликат]
Anonymous » » в форуме Php - 0 Ответы
- 18 Просмотры
-
Последнее сообщение Anonymous
-