Android intelligent chat robot development (I) gson’s brief use notes Android intelligent chat robot development (II)

This chat robot is a bit like a popular Android application some time ago - little yellow chicken

The implementation of the application is actually very simple. There are many intelligent robot chat interfaces on the Internet. We only need to call the corresponding interface and abide by its API development specifications to obtain the information we want

The interface I use here is Turing robot( http://www.tuling123.com/openapi/ )

This interface returns us a JSON string. We only need to parse the JSON string to implement this application.

Development steps:

First, we need to register an account on the official website of the Turing robot. It will give us a unique key. Through this key and the corresponding API development specification, we can carry out development.

And then in this( http://www.tuling123.com/openapi/cloud/access_api.jsp )Relevant development introduction can be found in the website

For example: request method, parameters, return parameters, including development examples, some returned codes and other information

Here is a small call case (Java) officially provided. I'll also post it here

Well, let's start the actual combat. I'm going to write two articles on this application

The first part talks about how to call the interface to obtain data from the Internet, including parsing JSON strings

The second part will embed the acquired data into Android applications

First, write a tool class, which is used to obtain the information entered by the user and return the data provided by the server

A jar package provided by a third party is used. Gson is provided by Google to serialize and deserialize JSON data

I wrote a note about the use of gson before. Unfamiliar friends can see it: brief notes on the use of gson( http://www.cnblogs.com/lichenwei/p/3987429.html )

Well, at this time, we can get the data from the server, receive the data from the client and process it. The next article, Android intelligent chat robot development (II), writes about how to embed it into Android applications.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>