首页 > 解决方案 > 如何制作 rss 提要更新时发送推送通知的 android 应用程序(webview)?

问题描述

如何制作 rss 提要更新时发送推送通知的 android 应用程序(webview)?是否可以构建这样的应用程序。我运行一个问答网站,我为我的网站开发了一个 webview,但是当 rss 提要更新(意味着有人提出新问题)时,如何向它添加推送通知。

标签: androidwebviewpush-notificationrss

解决方案


无法使用 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,请确保检查出来)。


推荐阅读