【问题标题】:How can I make android app (webview) which sends push notification when rss feeds updates?如何制作 rss 提要更新时发送推送通知的 android 应用程序(webview)?
【发布时间】:2020-05-01 04:23:44
【问题描述】:

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

【问题讨论】:

    标签: android webview push-notification rss


    【解决方案1】:

    不能使用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,请务必查看)。

    【讨论】:

    • 是的,我正在使用 php 和 mysql。我已经安装了这个东西question2answer.org/qa
    • 使用上述方法你不需要任何其他的sdk,它简单、安全、可修改
    • 你能告诉我应该把代码放在android studio webview源代码的哪里吗?我不是开发者
    猜你喜欢
    • 1970-01-01
    • 2019-06-10
    • 1970-01-01
    • 1970-01-01
    • 2019-05-07
    • 2020-07-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多