What I need for a successful GET request using retrofit android? - android

I'm trying to create my own application like an e-mail client. I use Retrofit library and I have already managed to create POST request for authorization via username and password. Maybe somebody can help me with structurising my general task(which classes I have to create or smth like that) because I can't create the strategy of its development. I'm a beginner in android development and also in retrofit library. When I first had made a POST request it was like a surprise because I didn't understand how it worked. So maybe somebody can advise me some tutorials or can explain from what I have to start for having s really successful GET request. I have some previous questions right here: Adding authorization header interface android retrofit. After some conversations with more professional developers, I have realized that I don't know where I have to begin. Thank you for your help.

I think This Tutorial is Good for you -> link

Related

Getting html of tumblr post using jumblr

I am developing my first Android application using the "jumblr" library to get the last post of a blog and then do some stuff.
The library is really easy to use. I create a jumblr client and insert keys, tokens and all the commands I tried to run worked.
Using
client.blogPosts("blogname.tumblr.com")
I get a list of posts but the problem comes when I try to get the text of one post, there are no methods allowing me to do this.
Am I missing something? Is this the wrong way to approach the problem?
I solved the problem casting the post to a TextPost.
List<Post> posts = client.blogPosts("blogname.tumblr.com");
String post = (TextPost)posts.get(0).getBody();

Android development: Getting data from WordPress

I'm making an android app for displaying some school events(Title of the event and a posted picture of the event).
The only thing I need for the app is getting data(String for title, ImageView for the picture)from a server.
The answer of this post, Android Development : Getting data from the web, seems to be the easiest and the most straight forward way I could find.
"The easiest way to display posts into an Android application will be
to use JSON data on the web, and read it into a Master Detail Android
application.
On the website side, getting the data to display in JSON seems to be
the most difficult part of your problem. It would be easy if it was a
Wordpress site, as there are plugins that will do this for you.
On the application side, getting the data and parsing it into a master
detail flow is a fairly trivial task."
I know almost nothing about database, networking, wordpress, and JSON. :(
I have made an wordpress account and install the JSON plugin and wordpress web server plugin. But that's how far I could get :(
My idea is
in the wordpress blog site: make a post for each new event. The title of the post is the event title and the content of the post just a picture, which is a post about the event.
in the app side: add a synchronize task within the onCreate function, so when the app is opened, it will check if there's any new post in the blog. If there's any, it will get the blog title and add to the listView, and get the picture inside of the blog and create a new layout in which has a ImageView for holding the picture.
As I said, I know nothing about web service and networking.
I have no clue about how to check if there's any new post in the blog comparing with those events already in the app.....
These two examples are the closet I could get.
http://android.programmerguru.com/android-webservice-example/
http://wordpress.org/support/topic/phonegap-android-app-built-around-json-api (I don't understand this one! :/)
Please help! This thing is giving me a big headache! And it's the last step I need for the app!
Any help or sample code will be greatly appreciated!!
And most importantly, Merry Christmas, everyone! XD
There is Wordpress plug-in called JSON-API it gives you ability to access every object of Wordpress( post ,page ,category.. etc ) in the form of JSON. you can use any rest client like volley from google, retrofit from Square or build your won to access wordpress data.
install Wordpress plug-in
http://wordpress.org/plugins/json-api/
for sample code you can look Wordpress for android source code on github
https://github.com/wordpress-mobile/WordPress-Android
I ended up with writing my own JSON.

Sending an OPTIONS request in Android is not working

I am trying to send an OPTIONS request from my android application to my Windows 2008 Server webservice (which is a .net webservice). I am using SSL, and am having difficulty getting this to work. I really need to know exactly what my headers should look like. I know I don't send the body, I just need to know what to send. I really need an example not a link to someone just talking about some things.
I found the answer. It was working. I just wasnt looking in the right place for my response. I was looking at the final response that I get from my Soapbuilder class, and I am stripping out the headers before returning. I is actually giving the right options headers back.

How to Implement Application server

I have to implement a client-server architecture where there are many android client located at different places querying the application server (running all the time (24x7)) and which will do task accordingly and reply to clients. But I don't know what exactly application server is and how to implement it and what is easiest and quickest way to implement this. I am running out of time that is why posting this question otherwise I would have gone through lot of tutorials instead.
The server code is to be written in php/c#/java.
Any quick help is highly appreciated.
You may have look at Google App Engine its easy to setup, hosted on google environment. Which might fulfill your need. In this case you don't need to buy hosting plans etc. etc. You will get yourappname.appspot.com URL to use app server.
Hope it helps!
Note:
Appengine supports Python and Java
You can implement it by knowing how the application servers work.
First of all, you should create a class that implements the HttpHandler, in handle method you can get header and body of the message.
Secondly, you should choose how to handle the request in HttpHandler. One possible approach can be using of ThreadPoolTaskExecutor or SimpleAsyncTaskExecutor or any task executors.
Finally, you should prepare the response messsage with exchange.getResponseHeaders() and exchange.getResponseBody()

Accessing a .NET web service via Android using JSON

I am a seasoned ASP.NET developer but a novice Android developer who is just getting started.
The first page in my new app is a login page. I would like to pass a username and password to my web service authentication method from my android app. I would like to employ JSON since, from what I've read, would be the most simple and clean method of transmitting data to a mobile device.
I've been searching around and trying to find sample code or syntax that would show me how to accomplish this but it's been difficult.
Here is a nice example exactly how to do it: http://www.geekmind.net/2009/11/android-simple-httpclient-to.html
It is an easy solution and it works.
Here is the thing you need to know
http://android.programmerguru.com/android-json-web-service-tutorial/
and try this also
http://android.programmerguru.com/how-to-call-asp-net-web-service-in-android/
Hope this will help you :)

Categories

Resources