使用推REST API在android系统消息 [英] Push Messages using REST api in android
问题描述
我正在开发使用Parse.com网站上的Android应用程序。其中任何用户发送必须由接收器接收到的数据,但在这里我不得不使用REST API。我成功地将数据发送到解析的网站,但现在我不得不推的数据只有REST API的帮助。我很困惑与REST API。帮助解决这个问题。
I am developing an Android app using Parse.com website. In which whatever user sends data that must be received by receiver, but here I have to use REST api. I succeeded to send data to Parse website but now I have to Push that data with the help of REST api only. I am confused with REST api. Help to solve it.
推荐答案
您可以使用库的。我建议这个 https://github.com/kodart/Httpzoid
它拥有干净的API和类型安全的数据。
You can use a library for that. I would suggest this one https://github.com/kodart/Httpzoid It has clean API and type-safe data.
下面是一个简单的使用例子
Here is a simple usage example
Http http = HttpFactory.create(context);
http.post("http://example.com/users")
.data(new User("John"))
.execute();
或更复杂的回调操作
Http http = HttpFactory.create(context);
http.post("http://example.com/users")
.data(new User("John"))
.handler(new ResponseHandler<Void>() {
@Override
public void success(Void ignore, HttpResponse response) {
}
@Override
public void error(String message, HttpResponse response) {
}
@Override
public void failure(NetworkError error) {
}
@Override
public void complete() {
}
}).execute();
这是全新的,但看起来非常有前途。
It is fresh new, but looks very promising.
这篇关于使用推REST API在android系统消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!