+ Start a Discussion
Narinder Singh 1Narinder Singh 1 

How to get my Chatter Feed Items in Android app?

Can anyone tell me how can I retrive my Chatter feed items. I am building an Android app using Mobile SDK
Best Answer chosen by Narinder Singh 1
Gaurav KheterpalGaurav Kheterpal
You can use the RestRequest class to hit the feed items endpoint as follows
 
RestRequest feedRequest = generateRequest("GET", "chatter/feeds/news/me/feed-items", null);

Then, call this request in a method which is fired from your activity class.
 
private void sendChatterRequest(RestRequest restRequest) {
    client.sendAsync(restRequest, new RestClient.AsyncRequestCallback() {
        @Override
        public void onSuccess(RestRequest request, RestResponse result) {
            try {
                //Do something with JSON result.
                println(result);  //Use our helper function, to print our JSON response.
            } catch (Exception e) {
                e.printStackTrace();
            }
            EventsObservable.get().notifyEvent(EventsObservable.EventType.RenditionComplete);
        }
        @Override
        public void onError(Exception e) {
            e.printStackTrace();
            EventsObservable.get().notifyEvent(EventsObservable.EventType.RenditionComplete);
        }
    });
}
If my answer helps resolve your query, please mark it as the 'Best Answer' to benefit others and improve the overall quality of Discussion Forums.

Gaurav Kheterpal
Certified Force.com Developer| Developer Forums Moderator| Dreamforce Speaker