命名 -
Google Play:com.example.v1app.[产品名/避免channel结尾]
完全体:com.example.v1app.[产品名].fullchannel
游戏完全体:com.example.v1game.[产品名].fullchannel
gradle和maven组名group:com.example.v1app.[产品名]
中国大陆:com.example.v1app.[产品名].chinachannel
中国大陆之外:com.example.v1app.[产品名].nonchinachannel
编程 -
消息实体或响应对象统一用com.openle.our.core.model.SwapInfo:
response.setStatus(HttpServletResponse.SC_OK);
response.setContentType("application/json; charset=utf-8");
response.addHeader("Access-Control-Allow-Origin", "*"); // CORS - doOptions/doGet/doPost
response.addHeader("X-Robots-Tag", "noindex"); // Google Search SEO优先于robots.txt
response.getWriter().print(new Gson().toJson(new SwapInfo.Builder(200, "text")));
JAX-RS: return Response.noContent().header("X-Robots-Tag", "noindex").build(); // 等同addHeader(k,v);
return Response.ok().header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_TYPE.withCharset("utf-8")).build();
编解码:
可逆Hex - Java 的 java.util.HexFormat.of().parseHex("e6b58be8af95") 可解码 JavaScript 编码(Array.from方法入参必须为无符号)的 Hex 字符串:
Array.from(new TextEncoder().encode("测试")).map(b=>b.toString(16).padStart(2, '0')).join('');
静态资源: https://staticfiles.openle.com/.well-known/static/public/v1/storage/people/main/network/delegated-apnic-latest_only-china-ipv6.json
Maven仓库: https://staticfiles.openle.com/.well-known/maven/our/maven-public-snapshot/com/openle/module/core/1.0.0-SNAPSHOT/maven-metadata.xml
异步脚本:
<script defer="defer" src="https://tsc.openle.com/.well-known/static/scripts/pv.js" ></script>
或 用无需实时的Web Worker:
document.addEventListener("DOMContentLoaded", () => {
console.log("or (e) => { }");
var jsFunction = function () { // 无法访问当前DOM变量,故应在Blob中先声明下该var。
fetch('https://example.com/x?x=' + xValue).then(r => console.log(r));
};
new Worker(URL.createObjectURL(new Blob(["var xValue='" + location.host + "';(" + jsFunction.toString() + ")()"])));
});
发布 -
都能聊:具有安装apk包的权限REQUEST_INSTALL_PACKAGES,符合Google Play的“支持附件的通信服务”政策。