[英]How do I connect my Android app to backend?
I want to connect my Android App to the back-end.我想将我的 Android 应用程序连接到后端。 The aim of the project is to filter spam messages.
该项目的目的是过滤垃圾邮件。 So the app receives SMSs and then should forward it to server for spam filtering which uses machine learning.
因此,该应用程序接收短信,然后应将其转发到服务器进行垃圾邮件过滤,该服务器使用机器学习。 Now, the thing is we have a python program for machine learning but I don't know how to connect these two things - the Android app and the python program.
现在,问题是我们有一个用于机器学习的 python 程序,但我不知道如何连接这两个东西 - Android 应用程序和 python 程序。 Need guidance on how the app can send data(sms) and receive response(whether spam of not) to and from the server-side.
需要有关应用程序如何向服务器端发送数据(短信)和接收响应(是否不是垃圾邮件)的指导。
A common approach is to connect your client with a web backend that offers a web API (might be a REST API).一种常见的方法是将您的客户端与提供 web API 的 web 后端连接(可能是 Z5073860F47F655EE0 APID)。
Here is a short overview over this topic: https://www.webiotic.com/api-for-mobile-apps/以下是对该主题的简短概述: https://www.webiotic.com/api-for-mobile-apps/
What you need is a web server which can receive web calls and send back information.您需要的是一个 web 服务器,它可以接收 web 呼叫并发回信息。 A web server in this sense is just a program which listens to incoming HTTP calls.
从这个意义上说,web 服务器只是一个监听传入 HTTP 调用的程序。
In your case, this might look like this:在您的情况下,这可能如下所示:
POST
on the route /checkMessage
/checkMessage
上使用 HTTP 方法POST
监听 web 调用{"message":"Your actual SMS message"}
{"message":"Your actual SMS message"}
{"isSpam":true}
{"isSpam":true}
POST
call to https://www.[YOUR_URL]/checkMessage
with the specified data and wait for a responsehttps://www.[YOUR_URL]/checkMessage
发送POST
调用并等待响应 As for which technology to use: It's up to you.至于使用哪种技术:由您决定。 You can create a web backend in pretty much every language.
您可以使用几乎所有语言创建 web 后端。 In your case, you should check out which Python libraries are available to listen to HTTP connections.
在您的情况下,您应该检查哪些 Python 库可用于侦听 HTTP 连接。
Keep in mind that if your app can publicly access your backend, then everybody else can as well.请记住,如果您的应用程序可以公开访问您的后端,那么其他人也可以。 You will want to add some kind of authentication as well.
您还需要添加某种身份验证。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.