如何在 Android 中实现 webhook? [英] How do I implement a webhook in Android?

查看:137
本文介绍了如何在 Android 中实现 webhook?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望在我的 Android 应用程序中有例如 www.example.com/status 的 URL,我将观察该 URL 并将接收来自服务器的多个 POST 请求.对于每个 POST 请求,我将触发一个功能.我不明白如何在 URL 24x7 上实现侦听器.我想要的只是一个开始的地方.如果这是不可能的,那么推送通知是一个可行的选择吗?

I want to have URL for examplewww.example.com/status in my Android app to which I will be observing and will be receiving multiple POST requests from the Server. With each POST request, I will trigger a feature. I don't understand how can I implement a listener on a URL 24x7. All I want is a place to start with. If this is not possible then is Push Notifications a viable option?

注意:webhook 不应该在服务器上,而应该在客户端 (Android) 上,服务器应该在 webhook 上发送请求.

Note: The webhook isn't supposed to be on the Server instead it should be on the Client (Android) and Server is supposed to send requests on the webhook.

推荐答案

您可以使用 firebase 推送通知.使用网络服务器向您的应用发送推送通知,并在 Firebase 事件服务内执行操作.

You can use firebase push notification . Use a web server to send push notification to your application, and perform the action inside the Firebase Event service.

这篇关于如何在 Android 中实现 webhook?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆