android - 如何制作 rss 提要更新时发送推送通知的 android 应用程序(webview)?
问题描述
如何制作 rss 提要更新时发送推送通知的 android 应用程序(webview)?是否可以构建这样的应用程序。我运行一个问答网站,我为我的网站开发了一个 webview,但是当 rss 提要更新(意味着有人提出新问题)时,如何向它添加推送通知。
解决方案
无法使用 Webview,如果您使用 php 和 mysql,请使用“HttpUrlConnection”和“Json”来发送和接收数据。它就像,
Url url = new Url("http://www.example.com/abc.php");
HttpUrlConnection conn = (HttpUrlConnection) url.openConnection();
conn.setRequestMethod("POST");
OutputStreme output = new OutputStreme(conn.getOutputStreme);//for sending Data to php
InputStreme input = new InputStreme(conn.getInputStreme);//for receiving Data from php
output.close;
input.close;
如果您想显示通知运行“异步任务”,它会在后台运行并通过 POST 方法频繁请求数据库,如果有任何更改显示通知(从 android 8.0 通知需要 CHANNEL_ID,请确保检查出来)。
推荐阅读
- jsf - 发送多个ajax请求的问题
- java - FlyWay .... 无法解析位置类路径:db/migration
- css - 如果父元素的宽度小于 500 像素,将子元素的宽度设置为自动?
- ios - 如何制作带有居中注释的可拖动地图
- c++ - 随机访问不同大小的原始缓冲区数组?
- python - 文件输入:for循环结束后无法打印列表
- ios - isHidden 属性更改时如何在导航栏上设置关闭?
- javascript - Javascript-Selenium WebDriverJS (Not Java using ashot)- 整页截图
- java - 在java中使用use和this关键字的正确方法是什么?
- android - 如何自定义 Floating-ArcMenu(卫星菜单选项)