如何检索职位从Word preSS博客在一个Android应用程序?应用程序、职位、博客、preSS

2023-09-05 06:17:29 作者:大爷范

我想开发浏览字preSS供电的博客,我拥有一个Android应用程序。我试图找出如何检索员额和其他信息在博客中的应用程序来显示。我已经找遍了,但我觉得完全丧失。这是不是可以完全用Java / XML来完成?如果是这样,怎么样?

I'm trying to develop an Android app for browsing a Wordpress-powered blog I own. I'm trying to figure out how to retrieve posts and other information from the blog to display in the app. I've looked all over but I feel completely lost. Is this something that can be done entirely in Java/XML? If so, how?

感谢您!

推荐答案

是的,是可以做到的。

Yes, it can be done.

的一种方法是使用xml-RPC API。字preSS博客有一个XML-RPC API(你需要启用这个词preSS博客下的设置 - 写作)。您还需要在博客上创建一个用户,你给至少读访问,并为您在您的应用程序的凭据。 从此,你可以做的XML-RPC调用您的Word preSS博客(S)。

One way is to use the xml-rpc api. Wordpress blogs have an xml-rpc api(which you need to enable on the Wordpress blog under "Settings - Writing"). You will also need to create a user on the blog, which you give at least read access, and for which you include the credentials in your app. From then on, you can do xml-rpc calls to your Wordpress blog(s).

如果使用此XML-RPC API是一个选项,看看这个Java lib目录下: HTTP://$c$c.google.com/p/word$p$pss-java/

If using this xml-rpc api is an option, take a look at this Java lib: http://code.google.com/p/wordpress-java/

您可以使用此LIB这样得到blogposts:

You can get the blogposts using this lib like this:

String username = args[0];
String password = args[1];
String xmlRpcUrl = args[2];
Wordpress wp = new Wordpress(username, password, xmlRpcUrl);
List<Page> recentPosts = wp.getRecentPosts(10);

此外,官方话语preSS Android应用程序是开源的。说明得到它在: HTTP://android.word$p$pss.org/development/ 您可以使用此源$ C ​​$ C作为起点,使其适应您的需求。

Also, the official Wordpress Android app is open source. Instructions to get it are at: http://android.wordpress.org/development/ You could use this source code as a starting point and adapt it to your needs.

请注意,您只能使用XML-RPC API时你有读访问权的用户。如果没有具有读取权限的用户的凭据,则可以使用XML-RPC API无法获得的职位。 抓取RSS源和解析RSS提要了部分Java的lib很可能是你最好的选择,然后(检查http://www.vogella.com/articles/RSSFeed/article.html如何阅读使用Java RSS源)。

Note that you can only use the xml-rpc api when you have a user with read access. If you do not have the credentials of a user with read access, you can't get the posts using the xml-rpc api. Fetching the rss feed and parsing the rss feed with some java lib would probably be your best bet then(check http://www.vogella.com/articles/RSSFeed/article.html on how to read an rss feed using Java).