How to retrieve posts from a WordPress Blog in an Android App?

前端 未结 3 2147
礼貌的吻别
礼貌的吻别 2021-01-30 11:51

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

3条回答
  •  [愿得一人]
    2021-01-30 12:35

    As Integrating Stuff said, the 'net.bican:jwordpress:0.6.4' is what you need. Still, the example he gave is now deprecated. There is no more getRecentPosts(int) but getPosts(FilterPost).

    So now the correct code is :

    String username = args[0];
    String password = args[1];
    String xmlRpcUrl = args[2];
    Wordpress wp = new Wordpress(username, password, xmlRpcUrl);
    FilterPost filter = new FilterPost() ;
    filter.setNumber(10);
    List recentPosts = wp.getPosts(filter);
    

    to know more check the example : https://github.com/canbican/wordpress-java/blob/bb4b60a008ee6d280aedd9174df4a657bff683ac/src/net/bican/wordpress/example/Main.java

    Also, if you're using Gradle, check this dependencies problem you may face : https://github.com/canbican/wordpress-java/issues/54

提交回复
热议问题